Browse Source

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
tags/1.2.0
Ade Lee 9 months ago
parent
commit
9750c363f6
2 changed files with 14 additions and 14 deletions
  1. +6
    -6
      novajoin/join.py
  2. +8
    -8
      novajoin/notifications.py

+ 6
- 6
novajoin/join.py View File

@@ -204,19 +204,19 @@ class JoinController(Controller):
managed_services = [metadata[key] for key in metadata.keys()
if key.startswith('managed_service_')]
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)
if compact_services:
self.handle_compact_services(hostname_short, compact_services)
self.add_compact_services(hostname_short, compact_services)

self.ipaclient.flush_batch_operation()

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."""
LOG.debug("In IPAHandleServices")
LOG.debug("In add_managed_services")

hosts_found = list()
services_found = list()
@@ -236,7 +236,7 @@ class JoinController(Controller):

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

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
metadta entries have a limit of 255 characters.
"""
LOG.debug("In handle compact services")
LOG.debug("In add_compact_services")

hosts_found = list()
services_found = list()


+ 8
- 8
novajoin/notifications.py View File

@@ -165,11 +165,11 @@ class NotificationEndpoint(object):
payload_metadata[key] for key in payload_metadata.keys()
if key.startswith('managed_service_')]
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)
if compact_services:
join_controller.handle_compact_services(
join_controller.add_compact_services(
hostname_short, compact_services)

ipa.flush_batch_operation()
@@ -268,14 +268,14 @@ class NotificationEndpoint(object):

compact_services = util.get_compact_services(metadata)
if compact_services:
self.handle_compact_services(ipa, hostname_short,
self.delete_compact_services(ipa, hostname_short,
compact_services)
managed_services = [metadata[key] for key in metadata.keys()
if key.startswith('managed_service_')]
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.

Data looks like this:
@@ -289,7 +289,7 @@ class NotificationEndpoint(object):
services to be automatically deleted through IPA referential
integrity.
"""
LOG.debug("In handle compact services")
LOG.debug("In delete compact services")
hosts_found = list()

ipa.start_batch_operation()
@@ -304,13 +304,13 @@ class NotificationEndpoint(object):
hosts_found.append(principal_host)
ipa.flush_batch_operation()

def handle_managed_services(self, ipa, services):
def delete_managed_services(self, ipa, services):
"""Delete any managed services if possible.

Checks to see if the managed service subhost has no managed hosts
associations and if so, deletes the host.
"""
LOG.debug("In handle_managed_services")
LOG.debug("In delete_managed_services")
hosts_deleted = list()
services_deleted = list()



Loading…
Cancel
Save