user-domain-name config added
configure-pg-sources function added
This commit is contained in:
commit
7845f465a1
|
@ -49,3 +49,7 @@ options:
|
|||
default: None
|
||||
description: |
|
||||
Proxy address to install python modules behind a proxy
|
||||
user-domain-name:
|
||||
type: string
|
||||
default: Default
|
||||
description: Keystone user domain name
|
||||
|
|
|
@ -118,6 +118,7 @@ class NeutronPGPluginContext(context.NeutronContext):
|
|||
pg_ctxt['pg_metadata_port'] = '8775'
|
||||
pg_ctxt['metadata_mode'] = 'tunnel'
|
||||
pg_ctxt['connector_type'] = config('connector-type')
|
||||
pg_ctxt['user_domain_name'] = config('user-domain-name')
|
||||
if enable_metadata:
|
||||
plumgrid_edge_ctxt = _edge_context()
|
||||
pg_ctxt['nova_metadata_proxy_secret'] = \
|
||||
|
|
|
@ -32,6 +32,7 @@ from neutron_plumgrid_utils import (
|
|||
restart_map,
|
||||
ensure_files,
|
||||
set_neutron_relation,
|
||||
configure_pg_sources
|
||||
)
|
||||
|
||||
hooks = Hooks()
|
||||
|
@ -65,6 +66,8 @@ def config_changed():
|
|||
charm_config.changed('plumgrid-build') or
|
||||
charm_config.changed('install_keys')):
|
||||
status_set('maintenance', 'Upgrading apt packages')
|
||||
if charm_config.changed('install_sources'):
|
||||
configure_pg_sources()
|
||||
configure_sources()
|
||||
apt_update()
|
||||
pkgs = determine_packages()
|
||||
|
|
|
@ -31,7 +31,7 @@ PG_PACKAGES = [
|
|||
]
|
||||
|
||||
NEUTRON_CONF_DIR = "/etc/neutron"
|
||||
|
||||
SOURCES_LIST = '/etc/apt/sources.list'
|
||||
SU_FILE = '/etc/sudoers.d/neutron_sudoers'
|
||||
PLUMGRID_CONF = '%s/plugins/plumgrid/plumgrid.ini' % NEUTRON_CONF_DIR
|
||||
PGLIB_CONF = '%s/plugins/plumgrid/plumlib.ini' % NEUTRON_CONF_DIR
|
||||
|
@ -63,6 +63,22 @@ NETWORKING_PLUMGRID_VERSION = OrderedDict([
|
|||
])
|
||||
|
||||
|
||||
def configure_pg_sources():
|
||||
'''
|
||||
Returns true if install sources is updated in sources.list file
|
||||
'''
|
||||
try:
|
||||
with open(SOURCES_LIST, 'r+') as sources:
|
||||
all_lines = sources.readlines()
|
||||
sources.seek(0)
|
||||
for i in (line for line in all_lines if "plumgrid" not in line):
|
||||
sources.write(i)
|
||||
sources.truncate()
|
||||
sources.close()
|
||||
except IOError:
|
||||
log('Unable to update /etc/apt/sources.list')
|
||||
|
||||
|
||||
def determine_packages():
|
||||
'''
|
||||
Returns list of packages required to be installed alongside neutron to
|
||||
|
|
|
@ -59,4 +59,5 @@ admin_password = {{ admin_password }}
|
|||
admin_tenant_name = {{ admin_tenant_name }}
|
||||
auth_uri = {{ service_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0/
|
||||
identity_version = v2.0
|
||||
user_domain_name = {{ user_domain_name }}
|
||||
{% endif -%}
|
||||
|
|
|
@ -60,6 +60,7 @@ class NeutronPGContextTest(CharmTestCase):
|
|||
'switch-username': 'plumgrid',
|
||||
'switch-password': 'plumgrid',
|
||||
'connector-type': 'service',
|
||||
'user-domain-name': 'Default',
|
||||
}
|
||||
|
||||
def mock_config(key=None):
|
||||
|
@ -90,6 +91,7 @@ class NeutronPGContextTest(CharmTestCase):
|
|||
'switch_password': 'plumgrid',
|
||||
'metadata_mode': 'tunnel',
|
||||
'connector_type': 'service',
|
||||
'user_domain_name': 'Default',
|
||||
'nova_metadata_proxy_secret': 'plumgrid',
|
||||
'pg_metadata_ip': '169.254.169.254',
|
||||
'pg_metadata_subnet': '169.254.169.254/30',
|
||||
|
|
Loading…
Reference in New Issue