def test_config_changed_git_updated(self, config_val_changed,
                                     git_requested, configure_https):
     git_requested.return_value = True
     repo = 'cloud:trusty-juno'
     openstack_origin_git = {
         'repositories': [
             {
                 'name': 'requirements',
                 'repository':
                 'git://git.openstack.org/openstack/requirements',  # noqa
                 'branch': 'stable/juno'
             },
             {
                 'name': 'glance',
                 'repository': 'git://git.openstack.org/openstack/glance',
                 'branch': 'stable/juno'
             }
         ],
         'directory':
         '/mnt/openstack-git',
     }
     projects_yaml = yaml.dump(openstack_origin_git)
     self.test_config.set('openstack-origin', repo)
     self.test_config.set('openstack-origin-git', projects_yaml)
     relations.config_changed()
     self.git_install.assert_called_with(projects_yaml)
     self.assertFalse(self.do_openstack_upgrade.called)
     self.assertTrue(configure_https.called)
예제 #2
0
 def test_config_changed_no_openstack_upgrade(self, configure_https,
                                              mock_update_policy):
     self.openstack_upgrade_available.return_value = False
     relations.config_changed()
     self.open_port.assert_called_with(9292)
     self.assertTrue(configure_https.called)
     self.assertTrue(mock_update_policy.called)
 def test_config_changed_no_openstack_upgrade(self, git_requested,
                                              configure_https):
     git_requested.return_value = False
     self.openstack_upgrade_available.return_value = False
     relations.config_changed()
     self.open_port.assert_called_with(9292)
     self.assertTrue(configure_https.called)
    def test_config_changed_with_openstack_upgrade_action(self, git_requested):
        git_requested.return_value = False
        self.openstack_upgrade_available.return_value = True
        self.test_config.set('action-managed-upgrade', True)

        relations.config_changed()
        self.assertFalse(self.do_openstack_upgrade.called)
예제 #5
0
    def test_config_changed_with_openstack_upgrade_action(self, git_requested):
        git_requested.return_value = False
        self.openstack_upgrade_available.return_value = True
        self.test_config.set('action-managed-upgrade', True)

        relations.config_changed()
        self.assertFalse(self.do_openstack_upgrade.called)
예제 #6
0
 def test_config_changed_no_openstack_upgrade(self, git_requested,
                                              configure_https):
     git_requested.return_value = False
     self.openstack_upgrade_available.return_value = False
     relations.config_changed()
     self.open_port.assert_called_with(9292)
     self.assertTrue(configure_https.called)
예제 #7
0
    def test_config_changed_with_openstack_upgrade_action(
            self, mock_update_policy):
        self.openstack_upgrade_available.return_value = True
        self.test_config.set('action-managed-upgrade', True)

        relations.config_changed()
        self.assertFalse(self.do_openstack_upgrade.called)
        self.assertTrue(mock_update_policy.called)
예제 #8
0
 def test_config_changed_with_openstack_upgrade(self, configure_https,
                                                status, mock_update_policy):
     self.openstack_upgrade_available.return_value = True
     relations.config_changed()
     status.assert_called_with('maintenance', 'Upgrading OpenStack release')
     self.assertTrue(self.do_openstack_upgrade.called)
     self.assertTrue(configure_https.called)
     self.assertTrue(mock_update_policy.called)
 def test_config_changed_with_openstack_upgrade(self, git_requested,
                                                configure_https, status):
     git_requested.return_value = False
     self.openstack_upgrade_available.return_value = True
     relations.config_changed()
     status.assert_called_with('maintenance', 'Upgrading OpenStack release')
     self.assertTrue(self.do_openstack_upgrade.called)
     self.assertTrue(configure_https.called)
예제 #10
0
def openstack_upgrade():
    """Upgrade packages to config-set Openstack version.

    If the charm was installed from source we cannot upgrade it.
    For backwards compatibility a config flag must be set for this
    code to run, otherwise a full service level upgrade will fire
    on config-changed."""
    if (do_action_openstack_upgrade('glance-common', do_openstack_upgrade,
                                    CONFIGS)):
        config_changed()
예제 #11
0
def openstack_upgrade():
    """Upgrade packages to config-set Openstack version.

    If the charm was installed from source we cannot upgrade it.
    For backwards compatibility a config flag must be set for this
    code to run, otherwise a full service level upgrade will fire
    on config-changed."""
    if (do_action_openstack_upgrade('glance-common',
                                    do_openstack_upgrade,
                                    CONFIGS)):
        config_changed()
예제 #12
0
 def test_config_changed_with_openstack_upgrade(self, git_requested,
                                                configure_https,
                                                status):
     git_requested.return_value = False
     self.openstack_upgrade_available.return_value = True
     relations.config_changed()
     status.assert_called_with(
         'maintenance',
         'Upgrading OpenStack release'
     )
     self.assertTrue(self.do_openstack_upgrade.called)
     self.assertTrue(configure_https.called)
예제 #13
0
def git_reinstall():
    """Reinstall from source and restart services.

    If the openstack-origin-git config option was used to install openstack
    from source git repositories, then this action can be used to reinstall
    from updated git repositories, followed by a restart of services."""
    if not git_install_requested():
        action_fail('openstack-origin-git is not configured')
        return

    try:
        git_install(config('openstack-origin-git'))
        config_changed()
    except:
        action_set({'traceback': traceback.format_exc()})
        action_fail('git-reinstall resulted in an unexpected error')
예제 #14
0
def git_reinstall():
    """Reinstall from source and restart services.

    If the openstack-origin-git config option was used to install openstack
    from source git repositories, then this action can be used to reinstall
    from updated git repositories, followed by a restart of services."""
    if not git_install_requested():
        action_fail('openstack-origin-git is not configured')
        return

    try:
        git_install(config('openstack-origin-git'))
        config_changed()
    except:
        action_set({'traceback': traceback.format_exc()})
        action_fail('git-reinstall resulted in an unexpected error')
예제 #15
0
 def test_config_changed_git_updated(self, config_val_changed,
                                     git_requested, configure_https):
     git_requested.return_value = True
     repo = 'cloud:trusty-juno'
     openstack_origin_git = {
         'repositories': [
             {'name': 'requirements',
              'repository': 'git://git.openstack.org/openstack/requirements',  # noqa
              'branch': 'stable/juno'},
             {'name': 'glance',
              'repository': 'git://git.openstack.org/openstack/glance',
              'branch': 'stable/juno'}
         ],
         'directory': '/mnt/openstack-git',
     }
     projects_yaml = yaml.dump(openstack_origin_git)
     self.test_config.set('openstack-origin', repo)
     self.test_config.set('openstack-origin-git', projects_yaml)
     relations.config_changed()
     self.git_install.assert_called_with(projects_yaml)
     self.assertFalse(self.do_openstack_upgrade.called)
     self.assertTrue(configure_https.called)