Merge "Use fetch.add_source"
This commit is contained in:
commit
9f579cb652
|
@ -641,8 +641,9 @@ class BaseOpenStackCharmActions(object):
|
|||
This configures the installation source for deb packages and then
|
||||
updates the packages list on the unit.
|
||||
"""
|
||||
os_utils.configure_installation_source(
|
||||
source, key = os_utils.get_source_and_pgp_key(
|
||||
self.config[self.source_config_key])
|
||||
fetch.add_source(source, key)
|
||||
fetch.apt_update(fatal=True)
|
||||
|
||||
@property
|
||||
|
@ -954,7 +955,9 @@ class BaseOpenStackCharmActions(object):
|
|||
mode=self.snap_mode),
|
||||
refresh=True)
|
||||
|
||||
os_utils.configure_installation_source(new_src)
|
||||
source, key = os_utils.get_source_and_pgp_key(
|
||||
self.config[self.source_config_key])
|
||||
fetch.add_source(source, key)
|
||||
fetch.apt_update()
|
||||
|
||||
dpkg_opts = [
|
||||
|
|
|
@ -98,13 +98,13 @@ class TestOpenStackCharm(BaseOpenStackCharmTest):
|
|||
self.remove_state.assert_called_once_with('hello')
|
||||
|
||||
def test_configure_source(self):
|
||||
self.patch_object(chm.os_utils,
|
||||
'configure_installation_source',
|
||||
name='cis')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'add_source')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'apt_update')
|
||||
self.patch_object(chm_core.os_utils, 'get_source_and_pgp_key')
|
||||
self.patch_target('config', new={'openstack-origin': 'an-origin'})
|
||||
self.get_source_and_pgp_key.return_value = ("an-origin", None)
|
||||
self.target.configure_source()
|
||||
self.cis.assert_called_once_with('an-origin')
|
||||
self.add_source.assert_called_once_with('an-origin', None)
|
||||
self.apt_update.assert_called_once_with(fatal=True)
|
||||
|
||||
def test_region(self):
|
||||
|
@ -698,6 +698,8 @@ class TestOpenStackAPICharm(BaseOpenStackCharmTest):
|
|||
def test_upgrade_charm(self):
|
||||
self.patch_target('setup_token_cache')
|
||||
self.patch_target('update_api_ports')
|
||||
self.patch_object(chm_core.os_utils, 'get_source_and_pgp_key')
|
||||
self.get_source_and_pgp_key.return_value = ("an-origin", None)
|
||||
self.target.upgrade_charm()
|
||||
self.target.setup_token_cache.assert_called_once_with()
|
||||
|
||||
|
|
|
@ -894,8 +894,9 @@ class TestMyOpenStackCharm(BaseOpenStackCharmTest):
|
|||
self.patch_target('config',
|
||||
new={'openstack-origin': 'cloud:natty-kilo'})
|
||||
self.patch_object(chm_core.os_utils, 'get_os_codename_install_source')
|
||||
self.patch_object(chm_core.os_utils, 'get_source_and_pgp_key')
|
||||
self.patch_object(chm_core.hookenv, 'log')
|
||||
self.patch_object(chm_core.os_utils, 'configure_installation_source')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'add_source')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'apt_update')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'apt_upgrade')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'apt_install')
|
||||
|
@ -906,9 +907,10 @@ class TestMyOpenStackCharm(BaseOpenStackCharmTest):
|
|||
return_value=['python-notinstalled'])
|
||||
self.patch_object(chm_core.os_utils, 'snap_install_requested',
|
||||
return_value=False)
|
||||
self.get_source_and_pgp_key.return_value = ('cloud:natty-kilo', None)
|
||||
self.target.do_openstack_pkg_upgrade()
|
||||
self.configure_installation_source.assert_called_once_with(
|
||||
'cloud:natty-kilo')
|
||||
self.add_source.assert_called_once_with(
|
||||
'cloud:natty-kilo', None)
|
||||
self.apt_update.assert_called_once_with()
|
||||
self.apt_upgrade.assert_called_once_with(
|
||||
dist=True, fatal=True,
|
||||
|
@ -933,7 +935,8 @@ class TestMyOpenStackCharm(BaseOpenStackCharmTest):
|
|||
new={'openstack-origin': 'snap:ocata/stable'})
|
||||
self.patch_object(chm_core.os_utils, 'get_os_codename_install_source')
|
||||
self.patch_object(chm_core.hookenv, 'log')
|
||||
self.patch_object(chm_core.os_utils, 'configure_installation_source')
|
||||
self.patch_object(chm_core.os_utils, 'get_source_and_pgp_key')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'add_source')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'apt_update')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'apt_upgrade')
|
||||
self.patch_object(chm_core.charmhelpers.fetch, 'apt_install')
|
||||
|
@ -943,9 +946,10 @@ class TestMyOpenStackCharm(BaseOpenStackCharmTest):
|
|||
self.patch_object(chm_core.os_utils,
|
||||
'get_snaps_install_info_from_origin',
|
||||
return_value=SNAP_MAP)
|
||||
self.get_source_and_pgp_key.return_value = ('snap:ocata/stable', None)
|
||||
self.target.do_openstack_pkg_upgrade()
|
||||
self.configure_installation_source.assert_called_once_with(
|
||||
'snap:ocata/stable')
|
||||
self.add_source.assert_called_once_with(
|
||||
'snap:ocata/stable', None)
|
||||
self.apt_update.assert_called_once_with()
|
||||
self.apt_upgrade.assert_called_once_with(
|
||||
dist=True, fatal=True,
|
||||
|
|
Loading…
Reference in New Issue