Skip to content

Commit cac91f0

Browse files
andrei-pavelMarcin Godzina
authored and
Marcin Godzina
committed
[#3445] hammer: add git and change bash to sh
1 parent 51c83b8 commit cac91f0

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

hammer.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def package(self):
775775
lxc_container_path = os.path.join('/var/lib/lxc', self.name)
776776

777777
# add vagrant universal key to accepted keys
778-
execute('sudo bash -c \'echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8ia'
778+
execute('sudo sh -c \'echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8ia'
779779
'llvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ'
780780
'6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTB'
781781
'ckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6k'
@@ -790,7 +790,7 @@ def package(self):
790790
execute('sudo rm -f %s/rootfs/etc/machine-id' % lxc_container_path)
791791

792792
# pack rootfs
793-
cmd = 'sudo bash -c "'
793+
cmd = 'sudo sh -c "'
794794
cmd += 'cd %s '
795795
cmd += '&& tar --numeric-owner --anchored --exclude=./rootfs/dev/log -czf %s/rootfs.tar.gz ./rootfs/*'
796796
cmd += '"'
@@ -1072,7 +1072,7 @@ def prepare_system(self):
10721072
def prepare_for_boxing(self):
10731073
if self.system in ['debian', 'ubuntu', 'fedora', 'centos', 'rhel', 'rocky']:
10741074
# setup a script that on first boot will set machine-id
1075-
cmd = 'bash -c \'cat <<EOF | sudo tee /usr/lib/systemd/system/systemd-firstboot.service\n'
1075+
cmd = 'sh -c \'cat <<EOF | sudo tee /usr/lib/systemd/system/systemd-firstboot.service\n'
10761076
cmd += '[Unit]\n'
10771077
cmd += 'Description=Generate New Machine ID\n'
10781078
cmd += 'Documentation=man:systemd-firstboot(1)\n'
@@ -1386,7 +1386,7 @@ def _configure_mysql(system, revision, features):
13861386
execute(cmd, raise_error=False)
13871387
cmd = "echo 'DROP USER 'keatest_secure'@'localhost';' | sudo mysql -u root"
13881388
execute(cmd, raise_error=False)
1389-
cmd = "bash -c \"cat <<EOF | sudo mysql -u root\n"
1389+
cmd = "sh -c \"cat <<EOF | sudo mysql -u root\n"
13901390
cmd += "CREATE DATABASE keatest;\n"
13911391
cmd += "CREATE USER 'keatest'@'localhost' IDENTIFIED BY 'keatest';\n"
13921392
cmd += "CREATE USER 'keatest_readonly'@'localhost' IDENTIFIED BY 'keatest';\n"
@@ -1412,7 +1412,7 @@ def _configure_mysql(system, revision, features):
14121412
execute(cmd)
14131413
cmd = "echo 'DROP USER 'keauser'@'localhost';' | sudo mysql -u root"
14141414
execute(cmd, raise_error=False)
1415-
cmd = "bash -c \"cat <<EOF | sudo mysql -u root\n"
1415+
cmd = "sh -c \"cat <<EOF | sudo mysql -u root\n"
14161416
cmd += "CREATE DATABASE keadb;\n"
14171417
cmd += "CREATE USER 'keauser'@'localhost' IDENTIFIED BY 'keapass';\n"
14181418
cmd += "GRANT ALL ON keadb.* TO 'keauser'@'localhost';\n"
@@ -1421,7 +1421,7 @@ def _configure_mysql(system, revision, features):
14211421

14221422
if system == 'debian' and revision == '9':
14231423
log.info('FIX FOR ISSUE kea#389: {} {}'.format(system, revision))
1424-
cmd = "bash -c \"cat <<EOF | sudo mysql -u root\n"
1424+
cmd = "sh -c \"cat <<EOF | sudo mysql -u root\n"
14251425
cmd += "use keatest;\n"
14261426
cmd += "set global innodb_large_prefix=on;\n"
14271427
cmd += "set global innodb_file_format=Barracuda;\n"
@@ -1544,7 +1544,7 @@ def _configure_pgsql(system, revision, features):
15441544

15451545
_restart_postgresql(system, revision)
15461546

1547-
cmd = """bash -c \"cat <<EOF | sudo -u postgres psql postgres
1547+
cmd = """sh -c \"cat <<EOF | sudo -u postgres psql postgres
15481548
DROP DATABASE IF EXISTS keatest;
15491549
DROP USER IF EXISTS keatest;
15501550
DROP USER IF EXISTS keatest_readonly;
@@ -1557,20 +1557,20 @@ def _configure_pgsql(system, revision, features):
15571557
execute(cmd, cwd='/tmp')
15581558

15591559
# This is needed for postgres >= 15
1560-
cmd = """bash -c \"cat <<EOF | sudo -u postgres psql -U postgres -d keatest
1560+
cmd = """sh -c \"cat <<EOF | sudo -u postgres psql -U postgres -d keatest
15611561
GRANT ALL PRIVILEGES ON SCHEMA public TO keatest;\n"""
15621562
cmd += 'EOF\n"'
15631563
execute(cmd, cwd='/tmp')
15641564

1565-
cmd = """bash -c \"cat <<EOF | sudo -u postgres psql -U keatest keatest
1565+
cmd = """sh -c \"cat <<EOF | sudo -u postgres psql -U keatest keatest
15661566
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO keatest_readonly;\n"""
15671567
cmd += 'EOF\n"'
15681568
env = os.environ.copy()
15691569
env['PGPASSWORD'] = 'keatest'
15701570
execute(cmd, cwd='/tmp', env=env)
15711571

15721572
if 'forge' in features:
1573-
cmd = "bash -c \"cat <<EOF | sudo -u postgres psql postgres\n"
1573+
cmd = "sh -c \"cat <<EOF | sudo -u postgres psql postgres\n"
15741574
cmd += "DROP DATABASE IF EXISTS keadb;\n"
15751575
cmd += "DROP USER IF EXISTS keauser;\n"
15761576
cmd += "CREATE USER keauser WITH PASSWORD 'keapass';\n"
@@ -1688,7 +1688,7 @@ def install_packages_local(system, revision, features, check_times, ignore_error
16881688
packages.extend(['ccache'])
16891689

16901690
if 'netconf' in features:
1691-
packages.extend(['cmake', 'pcre2-devel'])
1691+
packages.extend(['cmake', 'git', 'pcre2-devel'])
16921692

16931693
install_pkgs(packages, timeout=300, env=env, check_times=check_times)
16941694

@@ -1743,7 +1743,7 @@ def link_pg_config():
17431743
packages.extend(['ccache'])
17441744

17451745
if 'netconf' in features:
1746-
packages.extend(['cmake', 'pcre2-devel'])
1746+
packages.extend(['cmake', 'git', 'pcre2-devel'])
17471747

17481748
if 'unittest' in features:
17491749
packages.append('wget')
@@ -1795,7 +1795,7 @@ def link_pg_config():
17951795
packages.extend(['ccache'])
17961796

17971797
if 'netconf' in features:
1798-
packages.extend(['cmake', 'pcre2-devel'])
1798+
packages.extend(['cmake', 'git', 'pcre2-devel'])
17991799

18001800
if 'unittest' in features:
18011801
packages.append('wget')
@@ -1885,7 +1885,7 @@ def link_pg_config():
18851885
packages.extend(['ccache'])
18861886

18871887
if 'netconf' in features:
1888-
packages.extend(['cmake', 'libpcre2-dev'])
1888+
packages.extend(['cmake', 'git', 'libpcre2-dev'])
18891889

18901890
install_pkgs(packages, env=env, timeout=240, check_times=check_times)
18911891

@@ -1908,7 +1908,7 @@ def link_pg_config():
19081908
packages.append('googletest')
19091909

19101910
if 'netconf' in features:
1911-
packages.extend(['cmake', 'libpcre2-dev'])
1911+
packages.extend(['cmake', 'git', 'libpcre2-dev'])
19121912
if revision == '12':
19131913
packages.extend(['doxygen', 'graphviz', 'pkg-config'])
19141914

@@ -1986,7 +1986,7 @@ def link_pg_config():
19861986
packages.extend(['ccache'])
19871987

19881988
if 'netconf' in features:
1989-
packages.extend(['cmake', 'pcre2'])
1989+
packages.extend(['cmake', 'git', 'pcre2'])
19901990

19911991
install_pkgs(packages, env=env, timeout=6 * 60, check_times=check_times)
19921992

@@ -2015,7 +2015,7 @@ def link_pg_config():
20152015
_install_gtest_sources()
20162016

20172017
if 'netconf' in features:
2018-
packages.extend(['cmake', 'pcre2-dev'])
2018+
packages.extend(['cmake', 'git', 'pcre2-dev'])
20192019

20202020
if 'mysql' in features:
20212021
packages.extend(['mariadb-dev', 'mariadb', 'mariadb-client'])

0 commit comments

Comments
 (0)