2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-04 07:55:18 +00:00

hammer: added checking vagrant version, removed hammer from EXTRA_DIST

This commit is contained in:
Michal Nowikowski
2019-03-04 11:36:57 +01:00
parent e9f645d178
commit ea0006f6eb
2 changed files with 38 additions and 21 deletions

View File

@@ -157,9 +157,6 @@ EXTRA_DIST += tools/mk_cfgrpt.sh
#### include external sources in the distributed tarball: #### include external sources in the distributed tarball:
EXTRA_DIST += ext/coroutine/coroutine.hpp EXTRA_DIST += ext/coroutine/coroutine.hpp
# Add Hammer
EXTRA_DIST += hammer.py
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dns++.pc pkgconfig_DATA = dns++.pc

View File

@@ -9,6 +9,7 @@
from __future__ import print_function from __future__ import print_function
import os import os
import re
import sys import sys
import glob import glob
import time import time
@@ -1204,27 +1205,46 @@ def ssh(provider, system, revision):
ve.ssh() ve.ssh()
def _install_vagrant(ver='2.2.4', upgrade=False):
system, _ = get_system_revision()
if system in ['fedora', 'centos', 'rhel']:
if upgrade:
execute('sudo rpm -e vagrant')
rpm = 'vagrant_%s_x86_64.rpm' % ver
cmd = 'wget --no-verbose -O /tmp/%s ' % rpm
cmd += 'https://releases.hashicorp.com/vagrant/%s/%s' % (ver, rpm)
execute(cmd)
execute('sudo rpm -i /tmp/%s' % rpm)
os.unlink('/tmp/%s' % rpm)
elif system in ['debian', 'ubuntu']:
if upgrade:
execute('sudo dpkg --purge vagrant')
deb = 'vagrant_%s_x86_64.deb' % ver
cmd = 'wget --no-verbose -O /tmp/%s ' % deb
cmd += 'https://releases.hashicorp.com/vagrant/%s/%s' % (ver, deb)
execute(cmd)
execute('sudo dpkg -i /tmp/%s' % deb)
os.unlink('/tmp/%s' % deb)
else:
# TODO: check for packages here: https://www.vagrantup.com/downloads.html
raise NotImplementedError
def ensure_hammer_deps(): def ensure_hammer_deps():
"""Install Hammer dependencies onto current, host system.""" """Install Hammer dependencies onto current, host system."""
system, _ = get_system_revision() exitcode, out = execute('vagrant version', raise_error=False, capture=True)
exitcode = execute('vagrant version', raise_error=False)
if exitcode != 0: if exitcode != 0:
if system in ['fedora', 'centos', 'rhel']: _install_vagrant()
cmd = 'wget --no-verbose -O /tmp/vagrant_2.2.2_x86_64.rpm ' else:
cmd += 'https://releases.hashicorp.com/vagrant/2.2.2/vagrant_2.2.2_x86_64.rpm' m = re.search('Installed Version: ([\d\.]+)', out, re.I)
execute(cmd) ver = m.group(1)
execute('sudo rpm -i /tmp/vagrant_2.2.2_x86_64.rpm') major, minor, patch = [int(v) for v in ver.split('.')]
os.unlink('/tmp/vagrant_2.2.2_x86_64.rpm') # if ver < 2.2.3
elif system in ['debian', 'ubuntu']: if major < 2 or (major == 2 and (minor < 2 or (minor == 2 and patch < 3))):
cmd = 'wget --no-verbose -O /tmp/vagrant_2.2.2_x86_64.deb ' m = re.search('Latest Version: ([\d\.]+)', out, re.I)
cmd += 'https://releases.hashicorp.com/vagrant/2.2.2/vagrant_2.2.2_x86_64.deb' ver = m.group(1)
execute(cmd) _install_vagrant(ver, upgrade=True)
execute('sudo dpkg -i /tmp/vagrant_2.2.2_x86_64.deb')
os.unlink('/tmp/vagrant_2.2.2_x86_64.deb')
else:
# TODO: check for packages here: https://www.vagrantup.com/downloads.html
raise NotImplementedError
exitcode = execute('vagrant plugin list | grep vagrant-lxc', raise_error=False) exitcode = execute('vagrant plugin list | grep vagrant-lxc', raise_error=False)
if exitcode != 0: if exitcode != 0: