Disable online mos repos

Disable ubuntu mos-repos with potential updates for ubuntu bootstrap builder,
and their recovery in case of UPDATE_MASTER
Disable centos mos repos if FORCE_DISABLE_UPDATES

Change-Id: I55badf5f94df07a3d492d4f4d9ce4a56407453d0
This commit is contained in:
Artem Grechanichenko 2016-09-26 22:25:23 +03:00
parent b3346832f6
commit 1205c7ad38
2 changed files with 29 additions and 3 deletions

View File

@ -139,6 +139,15 @@ class AdminActions(BaseActions):
fuel_settings.pop(key) fuel_settings.pop(key)
fuel_settings['NTP1'] = router fuel_settings['NTP1'] = router
backup_path = "/var/astute.yaml"
YamlEditor(backup_path,
ip=self.admin_ip
).write_content(fuel_settings)
fuel_settings['BOOTSTRAP']['repos'] = \
[repo for repo in fuel_settings[
'BOOTSTRAP']['repos'] if "mos-" not in repo['name']]
self.save_fuel_settings(fuel_settings) self.save_fuel_settings(fuel_settings)
@logwrap @logwrap

View File

@ -179,13 +179,29 @@ class TestBasic(object):
time.sleep(10) time.sleep(10)
self.env.set_admin_keystone_password() self.env.set_admin_keystone_password()
self.env.sync_time(['admin']) self.env.sync_time(['admin'])
if settings.FORCE_DISABLE_UPDATES and settings.UPDATE_MASTER:
raise EnvironmentError(
"Cannot use FORCE_DISABLE_UPDATES and UPDATE_MASTER together")
if settings.FORCE_DISABLE_UPDATES: if settings.FORCE_DISABLE_UPDATES:
cmd = "yum-config-manager --disable mos9.0-* --save" cmd = "yum-config-manager --disable mos9.0-* --save"
self.ssh_manager.check_call( self.ssh_manager.check_call(
ip=self.ssh_manager.admin_ip, ip=self.ssh_manager.admin_ip,
command=cmd command=cmd
) )
elif settings.UPDATE_MASTER: elif settings.UPDATE_MASTER:
logger.warning("Restore online mos repos")
backup_path = "/var/astute.yaml"
admin_ip = self.env.get_admin_node_ip()
backup = YamlEditor(backup_path,
ip=admin_ip
).get_content()
with YamlEditor(settings.FUEL_SETTINGS_YAML,
ip=admin_ip) as editor:
editor.content['BOOTSTRAP']['repos'] = backup['BOOTSTRAP'][
'repos']
if settings.UPDATE_FUEL_MIRROR: if settings.UPDATE_FUEL_MIRROR:
for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): for i, url in enumerate(settings.UPDATE_FUEL_MIRROR):
conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i)
@ -200,9 +216,10 @@ class TestBasic(object):
cmd=cmd cmd=cmd
) )
if settings.EXTRA_DEB_REPOS: if settings.EXTRA_DEB_REPOS:
path = "/etc/fuel/astute.yaml" path = settings.FUEL_SETTINGS_YAML
with YamlEditor(path, with YamlEditor(
ip=self.env.get_admin_node_ip()) as editor: path,
ip=admin_ip) as editor:
editor.content['BOOTSTRAP']['repos'] = \ editor.content['BOOTSTRAP']['repos'] = \
replace_repos.replace_ubuntu_repos( replace_repos.replace_ubuntu_repos(
{'value': editor.content['BOOTSTRAP']['repos']}, {'value': editor.content['BOOTSTRAP']['repos']},