log.info('postgresql just configured')
+def _apt_update(system, revision, env=None, check_times=False, attempts=1, sleep_time_after_attempt=None,
+ capture=False):
+ cmd = 'sudo apt update'
+ if system == 'debian' and int(revision) >= 10:
+ cmd += ' --allow-releaseinfo-change'
+ return execute(cmd, env=env, check_times=check_times, attempts=attempts,
+ sleep_time_after_attempt=sleep_time_after_attempt, capture=capture)
+
+
def _install_cassandra_deb(system, revision, env, check_times):
"""Install Cassandra and cpp-driver using DEB package."""
if not os.path.exists('/usr/sbin/cassandra'):
execute(cmd, env=env, check_times=check_times)
execute('wget -qO- https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -',
env=env, check_times=check_times)
- execute('sudo apt update', env=env, check_times=check_times)
+ _apt_update(system, revision, env=env, check_times=check_times)
install_pkgs('cassandra libuv1 pkgconf', env=env, check_times=check_times)
if not os.path.exists('/usr/include/cassandra.h'):
# prepare ubuntu
elif system == 'ubuntu':
- execute('sudo apt update', env=env, check_times=check_times, attempts=3, sleep_time_after_attempt=10)
+ _apt_update(system, revision, env=env, check_times=check_times, attempts=3, sleep_time_after_attempt=10)
packages = ['gcc', 'g++', 'make', 'autoconf', 'automake', 'libtool', 'libssl-dev', 'liblog4cplus-dev',
'libboost-system-dev']
# prepare debian
elif system == 'debian':
- execute('sudo apt update', env=env, check_times=check_times, attempts=3, sleep_time_after_attempt=10)
+ _apt_update(system, revision, env=env, check_times=check_times, attempts=3, sleep_time_after_attempt=10)
packages = ['gcc', 'g++', 'make', 'autoconf', 'automake', 'libtool', 'libssl-dev',
'liblog4cplus-dev', 'libboost-system-dev']
env=env, check_times=check_times)
# try apt update for up to 10 times if there is an error
for _ in range(10):
- _, out = execute('sudo apt update', capture=True)
+ _, out = _apt_update(system, revision, capture=True)
if 'Bad header data' not in out:
break
time.sleep(4)