diff --git a/config.yaml b/config.yaml index 7782791..d609089 100644 --- a/config.yaml +++ b/config.yaml @@ -3,6 +3,14 @@ options: default: 192.168.100.250 type: string description: IP address of the Director's Management interface. Same IP can be used to access PG Console. + plumgrid-username: + default: plumgrid + type: string + description: Username to access PLUMgrid Director + plumgrid-password: + default: plumgrid + type: string + description: Password to access PLUMgrid Director lcm-ssh-key: default: 'null' type: string diff --git a/hooks/pg_dir_hooks.py b/hooks/pg_dir_hooks.py index 40e1d16..c298f38 100755 --- a/hooks/pg_dir_hooks.py +++ b/hooks/pg_dir_hooks.py @@ -87,6 +87,19 @@ def plumgrid_joined(relation_id=None): relation_set(relation_id=relation_id, opsvm_ip=opsvm_ip) +@hooks.hook('plumgrid-configs-relation-joined') +def plumgrid_configs_joined(relation_id=None): + ''' + This hook is run when relation with neutron-api-plumgrid is created. + ''' + relation_settings = { + 'plumgrid_virtual_ip': config('plumgrid-virtual-ip'), + 'plumgrid_username': config('plumgrid-username'), + 'plumgrid_password': config('plumgrid-password'), + } + relation_set(relation_id=relation_id, relation_settings=relation_settings) + + @hooks.hook('config-changed') def config_changed(): ''' @@ -108,6 +121,12 @@ def config_changed(): if charm_config.changed('plumgrid-virtual-ip'): CONFIGS.write_all() stop_pg() + for rid in relation_ids('plumgrid-configs'): + plumgrid_configs_joined(rid) + if (charm_config.changed('plumgrid-username') or + charm_config.changed('plumgrid-password')): + for rid in relation_ids('plumgrid-configs'): + plumgrid_configs_joined(rid) if (charm_config.changed('install_sources') or charm_config.changed('plumgrid-build') or charm_config.changed('install_keys') or diff --git a/metadata.yaml b/metadata.yaml index 3a00f13..d2660f9 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -15,6 +15,8 @@ requires: provides: plumgrid: interface: plumgrid + plumgrid-configs: + interface: plumgrid-configs peers: director: interface: director