Esempio n. 1
0
 def test_restart_map(self, mock_path_exists):
     self.os_release.return_value = 'havana'
     mock_path_exists.return_value = False
     _restart_map = nutils.restart_map()
     ML2CONF = "/etc/neutron/plugins/ml2/ml2_conf.ini"
     expect = OrderedDict([
         (nutils.NEUTRON_CONF, {
             'services': ['neutron-server'],
         }),
         (nutils.NEUTRON_DEFAULT, {
             'services': ['neutron-server'],
         }),
         (nutils.API_PASTE_INI, {
             'services': ['neutron-server'],
         }),
         (ML2CONF, {
             'services': ['neutron-server'],
         }),
         (nutils.APACHE_CONF, {
             'services': ['apache2'],
         }),
         (nutils.HAPROXY_CONF, {
             'services': ['haproxy'],
         }),
     ])
     self.assertItemsEqual(_restart_map, expect)
 def test_restart_map(self, mock_path_exists):
     self.os_release.return_value = 'havana'
     mock_path_exists.return_value = False
     _restart_map = nutils.restart_map()
     ML2CONF = "/etc/neutron/plugins/ml2/ml2_conf.ini"
     expect = OrderedDict([
         (nutils.NEUTRON_CONF, ['neutron-server']),
         (nutils.NEUTRON_DEFAULT, ['neutron-server']),
         (nutils.API_PASTE_INI, ['neutron-server']),
         (nutils.APACHE_CONF, ['apache2']),
         (nutils.HAPROXY_CONF, ['haproxy']),
         (ML2CONF, ['neutron-server']),
     ])
     self.assertEqual(_restart_map, expect)
 def test_restart_map_ssl(self, mock_path_exists, mock_path_isdir):
     self.os_release.return_value = 'havana'
     mock_path_exists.return_value = False
     mock_path_isdir.return_value = True
     _restart_map = nutils.restart_map()
     ML2CONF = "/etc/neutron/plugins/ml2/ml2_conf.ini"
     expect = OrderedDict([
         (nutils.NEUTRON_CONF, ['neutron-server']),
         (nutils.NEUTRON_DEFAULT, ['neutron-server']),
         (nutils.API_PASTE_INI, ['neutron-server']),
         (nutils.APACHE_CONF, ['apache2']),
         (nutils.HAPROXY_CONF, ['haproxy']),
         (ML2CONF, ['neutron-server']),
         ('{}/*'.format(nutils.APACHE_SSL_DIR),
          ['apache2', 'neutron-server']),
     ])
     self.assertEqual(_restart_map, expect)
 def test_restart_map(self, mock_path_exists):
     mock_path_exists.return_value = False
     _restart_map = nutils.restart_map()
     ML2CONF = "/etc/neutron/plugins/ml2/ml2_conf.ini"
     expect = OrderedDict([
         (nutils.NEUTRON_CONF, {
             'services': ['neutron-server'],
         }),
         (nutils.NEUTRON_DEFAULT, {
             'services': ['neutron-server'],
         }),
         (ML2CONF, {
             'services': ['neutron-server'],
         }),
         (nutils.APACHE_CONF, {
             'services': ['apache2'],
         }),
         (nutils.HAPROXY_CONF, {
             'services': ['haproxy'],
         }),
     ])
     self.assertItemsEqual(_restart_map, expect)
    status_set('maintenance', 'Git install')
    git_install(config('openstack-origin-git'))

    [open_port(port) for port in determine_ports()]

    if neutron_plugin == 'midonet':
        mkdir('/etc/neutron/plugins/midonet',
              owner='neutron',
              group='neutron',
              perms=0o755,
              force=False)


@hooks.hook('vsd-rest-api-relation-joined')
@restart_on_change(restart_map(), stopstart=True)
def relation_set_nuage_cms_name(rid=None):
    if CompareOpenStackReleases(os_release('neutron-server')) >= 'kilo':
        if config('vsd-cms-name') is None:
            e = "Neutron Api hook failed as vsd-cms-name" \
                " is not specified"
            status_set('blocked', e)
        else:
            relation_data = {
                'vsd-cms-name': '{}'.format(config('vsd-cms-name'))
            }
            relation_set(relation_id=rid, **relation_data)


@hooks.hook('vsd-rest-api-relation-changed')
@restart_on_change(restart_map(), stopstart=True)
            except Exception as e:
                log('install failed with error: {}'.format(e.message))
                raise Exception(e)

    status_set('maintenance', 'Git install')
    git_install(config('openstack-origin-git'))

    [open_port(port) for port in determine_ports()]

    if neutron_plugin == 'midonet':
        mkdir('/etc/neutron/plugins/midonet', owner='neutron', group='neutron',
              perms=0o755, force=False)


@hooks.hook('vsd-rest-api-relation-joined')
@restart_on_change(restart_map(), stopstart=True)
def relation_set_nuage_cms_name(rid=None):
    if os_release('neutron-server') >= 'kilo':
        if config('vsd-cms-name') is None:
            e = "Neutron Api hook failed as vsd-cms-name" \
                " is not specified"
            status_set('blocked', e)
        else:
            relation_data = {
                'vsd-cms-name': '{}'.format(config('vsd-cms-name'))
            }
            relation_set(relation_id=rid, **relation_data)


@hooks.hook('vsd-rest-api-relation-changed')
@restart_on_change(restart_map(), stopstart=True)