def neutron_plugin_joined(relation_id=None, request_restart=False): secret = None if not is_container(): if enable_local_dhcp(): install_packages() else: pkgs = deepcopy(DHCP_PACKAGES) # NOTE: only purge metadata packages if dvr is not # in use as this will remove the l3 agent # see https://pad.lv/1515008 if not use_dvr(): # NOTE(fnordahl) do not remove ``haproxy``, the principal # charm may have use for it. LP: #1832739 pkgs.extend(set(METADATA_PACKAGES)-set(['haproxy'])) purge_packages(pkgs) secret = get_shared_secret() if enable_nova_metadata() else None rel_data = { 'metadata-shared-secret': secret, } host_info = os_context.HostInfoContext()() if use_fqdn_hint() and host_info.get('host_fqdn'): rel_data.update({'host': host_info['host_fqdn']}) if request_restart: rel_data['restart-nonce'] = str(uuid.uuid4()) relation_set(relation_id=relation_id, **rel_data)
def neutron_plugin_joined(relation_id=None): if enable_local_dhcp(): install_packages() else: purge_packages(DHCP_PACKAGES) secret = get_shared_secret() if enable_nova_metadata() else None rel_data = { 'metadata-shared-secret': secret, } relation_set(relation_id=relation_id, **rel_data)
def neutron_plugin_joined(relation_id=None): if enable_local_dhcp(): install_packages() else: pkgs = deepcopy(DHCP_PACKAGES) # NOTE: only purge metadata packages if dvr is not # in use as this will remove the l3 agent # see https://pad.lv/1515008 if not use_dvr(): pkgs.extend(METADATA_PACKAGES) purge_packages(pkgs) secret = get_shared_secret() if enable_nova_metadata() else None rel_data = { 'metadata-shared-secret': secret, } relation_set(relation_id=relation_id, **rel_data)
def test_get_shared_secret(self, _dvr_secret_ctxt): _dvr_secret_ctxt.return_value = \ DummyContext(return_value={'shared_secret': 'supersecret'}) self.assertEqual(nutils.get_shared_secret(), 'supersecret')