mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-23 10:27:36 +00:00
[#2539] mostly cosmetical changes to hammer.py
This commit is contained in:
parent
bb29471b79
commit
30b7cb750e
34
hammer.py
34
hammer.py
@ -329,6 +329,7 @@ def execute(cmd, timeout=60, cwd=None, env=None, raise_error=True, dry_run=False
|
|||||||
used for e.g. SSH
|
used for e.g. SSH
|
||||||
:param int attempts: number of attempts to run the command if it fails
|
:param int attempts: number of attempts to run the command if it fails
|
||||||
:param int sleep_time_after_attempt: number of seconds to sleep before taking next attempt
|
:param int sleep_time_after_attempt: number of seconds to sleep before taking next attempt
|
||||||
|
:param bool super_quiet: if True, set quiet to True and don't log command
|
||||||
"""
|
"""
|
||||||
if super_quiet:
|
if super_quiet:
|
||||||
quiet = True
|
quiet = True
|
||||||
@ -364,7 +365,7 @@ def execute(cmd, timeout=60, cwd=None, env=None, raise_error=True, dry_run=False
|
|||||||
if line:
|
if line:
|
||||||
line_decoded = line.decode(encoding='ascii', errors='ignore').rstrip() + '\r'
|
line_decoded = line.decode(encoding='ascii', errors='ignore').rstrip() + '\r'
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(line_decoded)
|
log.info(line_decoded)
|
||||||
if capture:
|
if capture:
|
||||||
output += line_decoded
|
output += line_decoded
|
||||||
if log_file_path:
|
if log_file_path:
|
||||||
@ -1051,20 +1052,27 @@ class VagrantEnv(object):
|
|||||||
def _install_gtest_sources():
|
def _install_gtest_sources():
|
||||||
"""Install gtest sources."""
|
"""Install gtest sources."""
|
||||||
# download gtest sources only if it is not present as native package
|
# download gtest sources only if it is not present as native package
|
||||||
if not os.path.exists('/usr/src/googletest-release-1.10.0/googletest'):
|
gtest_version = '1.10.0'
|
||||||
cmd = 'wget --no-verbose -O /tmp/gtest.tar.gz '
|
gtest_path = f'/usr/src/googletest-release-{gtest_version}/googletest'
|
||||||
cmd += 'https://github.com/google/googletest/archive/release-1.10.0.tar.gz'
|
if os.path.exists(gtest_path):
|
||||||
execute(cmd)
|
log.info(f'gtest is already installed in {gtest_path}.')
|
||||||
execute('sudo mkdir -p /usr/src')
|
return
|
||||||
execute('sudo tar -C /usr/src -zxf /tmp/gtest.tar.gz')
|
|
||||||
execute('sudo ln -sf /usr/src/googletest-release-1.10.0 /usr/src/googletest')
|
cmd = 'wget --no-verbose -O /tmp/gtest.tar.gz '
|
||||||
os.unlink('/tmp/gtest.tar.gz')
|
cmd += f'https://github.com/google/googletest/archive/release-{gtest_version}.tar.gz'
|
||||||
|
execute(cmd)
|
||||||
|
execute('sudo mkdir -p /usr/src')
|
||||||
|
execute('sudo tar -C /usr/src -zxf /tmp/gtest.tar.gz')
|
||||||
|
execute(f'sudo ln -sf /usr/src/googletest-release-{gtest_version} /usr/src/googletest')
|
||||||
|
os.unlink('/tmp/gtest.tar.gz')
|
||||||
|
|
||||||
|
|
||||||
def _install_libyang_from_sources():
|
def _install_libyang_from_sources():
|
||||||
"""Install libyang from sources."""
|
"""Install libyang from sources."""
|
||||||
for prefix in ['/usr', '/usr/local']:
|
for prefix in ['/usr', '/usr/local']:
|
||||||
if os.path.exists('%s/include/libyang/libyang.h' % prefix):
|
libyang_path = f'{prefix}/include/libyang/libyang.h'
|
||||||
|
if os.path.exists(libyang_path):
|
||||||
|
log.info(f'libyang is already installed in {libyang_path}.')
|
||||||
return
|
return
|
||||||
|
|
||||||
execute('rm -rf /tmp/libyang')
|
execute('rm -rf /tmp/libyang')
|
||||||
@ -1082,7 +1090,9 @@ def _install_libyang_from_sources():
|
|||||||
def _install_sysrepo_from_sources():
|
def _install_sysrepo_from_sources():
|
||||||
"""Install sysrepo from sources."""
|
"""Install sysrepo from sources."""
|
||||||
for prefix in ['/usr', '/usr/local']:
|
for prefix in ['/usr', '/usr/local']:
|
||||||
if os.path.exists('%s/include/sysrepo.h' % prefix):
|
sysrepo_path = f'{prefix}/include/sysrepo.h'
|
||||||
|
if os.path.exists(sysrepo_path):
|
||||||
|
log.info(f'sysrepo is already installed in {sysrepo_path}.')
|
||||||
return
|
return
|
||||||
|
|
||||||
# sysrepo is picky about the libyang version it uses. If the wrong version
|
# sysrepo is picky about the libyang version it uses. If the wrong version
|
||||||
@ -1415,7 +1425,7 @@ def _apt_update(system, revision, env=None, check_times=False, attempts=1, sleep
|
|||||||
def _install_freeradius_client(system, revision, features, env, check_times):
|
def _install_freeradius_client(system, revision, features, env, check_times):
|
||||||
"""Install FreeRADIUS-client with necessary patches from Francis Dupont."""
|
"""Install FreeRADIUS-client with necessary patches from Francis Dupont."""
|
||||||
# check if it is already installed
|
# check if it is already installed
|
||||||
if (os.path.exists('/usr/local/lib/libfreeradius-client.so.2.0.0') and
|
if (os.path.exists('/usr/local/lib/libfreeradius-client.so') and
|
||||||
os.path.exists('/usr/local/include/freeradius-client.h')):
|
os.path.exists('/usr/local/include/freeradius-client.h')):
|
||||||
log.info('freeradius-client is already installed.')
|
log.info('freeradius-client is already installed.')
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user