Refactor method names
Debugging is confusing when the same names are used for methods in two different controllers. Fixing this to more accurately reflect whats going on. Change-Id: I3740cd3ae81776cb1ecf066e617e615d880dc2e8
This commit is contained in:
parent
6ed30c9476
commit
9750c363f6
|
@ -204,19 +204,19 @@ class JoinController(Controller):
|
||||||
managed_services = [metadata[key] for key in metadata.keys()
|
managed_services = [metadata[key] for key in metadata.keys()
|
||||||
if key.startswith('managed_service_')]
|
if key.startswith('managed_service_')]
|
||||||
if managed_services:
|
if managed_services:
|
||||||
self.handle_services(data['hostname'], managed_services)
|
self.add_managed_services(data['hostname'], managed_services)
|
||||||
|
|
||||||
compact_services = util.get_compact_services(metadata)
|
compact_services = util.get_compact_services(metadata)
|
||||||
if compact_services:
|
if compact_services:
|
||||||
self.handle_compact_services(hostname_short, compact_services)
|
self.add_compact_services(hostname_short, compact_services)
|
||||||
|
|
||||||
self.ipaclient.flush_batch_operation()
|
self.ipaclient.flush_batch_operation()
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def handle_services(self, base_host, services):
|
def add_managed_services(self, base_host, services):
|
||||||
"""Make any host/principal assignments passed into metadata."""
|
"""Make any host/principal assignments passed into metadata."""
|
||||||
LOG.debug("In IPAHandleServices")
|
LOG.debug("In add_managed_services")
|
||||||
|
|
||||||
hosts_found = list()
|
hosts_found = list()
|
||||||
services_found = list()
|
services_found = list()
|
||||||
|
@ -236,7 +236,7 @@ class JoinController(Controller):
|
||||||
|
|
||||||
self.ipaclient.service_add_host(principal, base_host)
|
self.ipaclient.service_add_host(principal, base_host)
|
||||||
|
|
||||||
def handle_compact_services(self, base_host_short, service_repr):
|
def add_compact_services(self, base_host_short, service_repr):
|
||||||
"""Make any host/principal assignments passed from metadata
|
"""Make any host/principal assignments passed from metadata
|
||||||
|
|
||||||
This takes a dictionary representation of the services and networks
|
This takes a dictionary representation of the services and networks
|
||||||
|
@ -270,7 +270,7 @@ class JoinController(Controller):
|
||||||
This attempts to do a more compact representation since the nova
|
This attempts to do a more compact representation since the nova
|
||||||
metadta entries have a limit of 255 characters.
|
metadta entries have a limit of 255 characters.
|
||||||
"""
|
"""
|
||||||
LOG.debug("In handle compact services")
|
LOG.debug("In add_compact_services")
|
||||||
|
|
||||||
hosts_found = list()
|
hosts_found = list()
|
||||||
services_found = list()
|
services_found = list()
|
||||||
|
|
|
@ -165,11 +165,11 @@ class NotificationEndpoint(object):
|
||||||
payload_metadata[key] for key in payload_metadata.keys()
|
payload_metadata[key] for key in payload_metadata.keys()
|
||||||
if key.startswith('managed_service_')]
|
if key.startswith('managed_service_')]
|
||||||
if managed_services:
|
if managed_services:
|
||||||
join_controller.handle_services(hostname, managed_services)
|
join_controller.add_managed_services(hostname, managed_services)
|
||||||
|
|
||||||
compact_services = util.get_compact_services(payload_metadata)
|
compact_services = util.get_compact_services(payload_metadata)
|
||||||
if compact_services:
|
if compact_services:
|
||||||
join_controller.handle_compact_services(
|
join_controller.add_compact_services(
|
||||||
hostname_short, compact_services)
|
hostname_short, compact_services)
|
||||||
|
|
||||||
ipa.flush_batch_operation()
|
ipa.flush_batch_operation()
|
||||||
|
@ -268,14 +268,14 @@ class NotificationEndpoint(object):
|
||||||
|
|
||||||
compact_services = util.get_compact_services(metadata)
|
compact_services = util.get_compact_services(metadata)
|
||||||
if compact_services:
|
if compact_services:
|
||||||
self.handle_compact_services(ipa, hostname_short,
|
self.delete_compact_services(ipa, hostname_short,
|
||||||
compact_services)
|
compact_services)
|
||||||
managed_services = [metadata[key] for key in metadata.keys()
|
managed_services = [metadata[key] for key in metadata.keys()
|
||||||
if key.startswith('managed_service_')]
|
if key.startswith('managed_service_')]
|
||||||
if managed_services:
|
if managed_services:
|
||||||
self.handle_managed_services(ipa, managed_services)
|
self.delete_managed_services(ipa, managed_services)
|
||||||
|
|
||||||
def handle_compact_services(self, ipa, host_short, service_repr):
|
def delete_compact_services(self, ipa, host_short, service_repr):
|
||||||
"""Reconstructs and removes subhosts for compact services.
|
"""Reconstructs and removes subhosts for compact services.
|
||||||
|
|
||||||
Data looks like this:
|
Data looks like this:
|
||||||
|
@ -289,7 +289,7 @@ class NotificationEndpoint(object):
|
||||||
services to be automatically deleted through IPA referential
|
services to be automatically deleted through IPA referential
|
||||||
integrity.
|
integrity.
|
||||||
"""
|
"""
|
||||||
LOG.debug("In handle compact services")
|
LOG.debug("In delete compact services")
|
||||||
hosts_found = list()
|
hosts_found = list()
|
||||||
|
|
||||||
ipa.start_batch_operation()
|
ipa.start_batch_operation()
|
||||||
|
@ -304,13 +304,13 @@ class NotificationEndpoint(object):
|
||||||
hosts_found.append(principal_host)
|
hosts_found.append(principal_host)
|
||||||
ipa.flush_batch_operation()
|
ipa.flush_batch_operation()
|
||||||
|
|
||||||
def handle_managed_services(self, ipa, services):
|
def delete_managed_services(self, ipa, services):
|
||||||
"""Delete any managed services if possible.
|
"""Delete any managed services if possible.
|
||||||
|
|
||||||
Checks to see if the managed service subhost has no managed hosts
|
Checks to see if the managed service subhost has no managed hosts
|
||||||
associations and if so, deletes the host.
|
associations and if so, deletes the host.
|
||||||
"""
|
"""
|
||||||
LOG.debug("In handle_managed_services")
|
LOG.debug("In delete_managed_services")
|
||||||
hosts_deleted = list()
|
hosts_deleted = list()
|
||||||
services_deleted = list()
|
services_deleted = list()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue