Skip to content

Commit dc801e2

Browse files
committed
Merge PKIDeployer.join_security_domain() into get_install_token()
1 parent 01dee19 commit dc801e2

1 file changed

Lines changed: 13 additions & 20 deletions

File tree

base/server/python/pki/server/deployment/__init__.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,14 +2681,22 @@ def sd_logout(self):
26812681

26822682
def get_install_token(self):
26832683

2684-
logger.info('Getting install token')
2684+
sd_url = self.mdict['pki_security_domain_uri']
2685+
logger.info('Getting install token from %s', sd_url)
2686+
2687+
url = urllib.parse.urlparse(sd_url)
2688+
sd_hostname = url.hostname
2689+
sd_port = str(url.port)
2690+
2691+
sd_subsystem = self.domain_info.subsystems['CA']
2692+
self.sd_host = sd_subsystem.get_host(sd_hostname, sd_port)
26852693

26862694
hostname = self.mdict['pki_hostname']
26872695
subsystem = self.subsystem_type
26882696

26892697
ca_client = pki.ca.CAClient(self.sd_client)
2690-
token_client = pki.system.SecurityDomainClient(ca_client)
2691-
install_token = token_client.get_install_token(hostname, subsystem)
2698+
sd_token_client = pki.system.SecurityDomainClient(ca_client)
2699+
self.install_token = sd_token_client.get_install_token(hostname, subsystem)
26922700

26932701
# Sleep for a bit to allow the install token to replicate to other clones.
26942702
# In the future this can be replaced with signed tokens.
@@ -2699,21 +2707,6 @@ def get_install_token(self):
26992707
sd_delay = self.mdict.get('pki_security_domain_post_login_sleep_seconds', '5')
27002708
time.sleep(int(sd_delay))
27012709

2702-
return install_token
2703-
2704-
def join_security_domain(self):
2705-
2706-
sd_url = self.mdict['pki_security_domain_uri']
2707-
2708-
url = urllib.parse.urlparse(sd_url)
2709-
sd_hostname = url.hostname
2710-
sd_port = str(url.port)
2711-
2712-
sd_subsystem = self.domain_info.subsystems['CA']
2713-
self.sd_host = sd_subsystem.get_host(sd_hostname, sd_port)
2714-
2715-
self.install_token = self.get_install_token()
2716-
27172710
def leave_security_domain(self, subsystem):
27182711

27192712
sd_host = subsystem.config.get('securitydomain.host')
@@ -2768,7 +2761,7 @@ def setup_security_domain(self, subsystem):
27682761
sd_url = self.mdict['pki_security_domain_uri']
27692762
logger.info('Joining security domain at %s', sd_url)
27702763

2771-
self.join_security_domain()
2764+
self.get_install_token()
27722765

27732766
subsystem.set_config('securitydomain.host', self.sd_host.Hostname)
27742767
subsystem.set_config('securitydomain.httpport', self.sd_host.Port)
@@ -2780,7 +2773,7 @@ def setup_security_domain(self, subsystem):
27802773
config.str2bool(self.mdict['pki_subordinate_create_new_security_domain']):
27812774

27822775
logger.info('Creating new subordinate security domain')
2783-
self.join_security_domain()
2776+
self.get_install_token()
27842777

27852778
else:
27862779
logger.info('Creating new security domain')

0 commit comments

Comments
 (0)