Skip to content

Commit bfbd84a

Browse files
committed
Replace PKIDeployer.sd_connection with sd_client
1 parent 50c3958 commit bfbd84a

1 file changed

Lines changed: 15 additions & 21 deletions

File tree

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

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(self):
120120
if not len(self.dns_domainname):
121121
self.dns_domainname = self.hostname
122122

123-
self.sd_connection = None
123+
self.sd_client = None
124124

125125
self.domain_info = None
126126
self.sd_host = None
@@ -2622,15 +2622,10 @@ def ds_close(self, ds_connection):
26222622

26232623
def sd_connect(self):
26242624

2625-
if self.sd_connection:
2626-
return self.sd_connection
2625+
if self.sd_client:
2626+
return self.sd_client
26272627

26282628
sd_url = self.mdict['pki_security_domain_uri']
2629-
2630-
url = urllib.parse.urlparse(sd_url)
2631-
sd_hostname = url.hostname
2632-
sd_port = str(url.port)
2633-
26342629
logger.info('Connecting to security domain at %s', sd_url)
26352630

26362631
conf_dir = os.path.join(pki.server.PKIServer.CONFIG_DIR,
@@ -2651,23 +2646,21 @@ def sd_connect(self):
26512646

26522647
ca_cert = cert_chain_path
26532648

2654-
self.sd_connection = pki.client.PKIConnection(
2655-
protocol='https',
2656-
hostname=sd_hostname,
2657-
port=sd_port,
2649+
self.sd_client = pki.client.PKIClient(
2650+
url=sd_url,
26582651
trust_env=False,
2659-
cert_paths=ca_cert)
2652+
ca_bundle=ca_cert)
26602653

2661-
return self.sd_connection
2654+
return self.sd_client
26622655

26632656
def get_domain_info(self):
26642657

26652658
logger.info('Getting security domain info')
26662659

26672660
self.sd_connect()
26682661

2669-
sd_client = pki.system.SecurityDomainClient(self.sd_connection)
2670-
domain_info = sd_client.get_domain_info()
2662+
sd_domain_client = pki.system.SecurityDomainClient(self.sd_client)
2663+
domain_info = sd_domain_client.get_domain_info()
26712664

26722665
return domain_info
26732666

@@ -2676,13 +2669,14 @@ def sd_login(self):
26762669
sd_user = self.mdict['pki_security_domain_user']
26772670
sd_password = self.mdict['pki_security_domain_password']
26782671

2679-
self.sd_connection.authenticate(sd_user, sd_password)
2672+
sd_connection = self.sd_client.connection
2673+
sd_connection.authenticate(sd_user, sd_password)
26802674

2681-
account = pki.account.AccountClient(self.sd_connection, subsystem='ca')
2675+
account = pki.account.AccountClient(self.sd_client, subsystem='ca')
26822676
account.login()
26832677

26842678
def sd_logout(self):
2685-
account = pki.account.AccountClient(self.sd_connection, subsystem='ca')
2679+
account = pki.account.AccountClient(self.sd_client, subsystem='ca')
26862680
account.logout()
26872681

26882682
def get_install_token(self):
@@ -2692,8 +2686,8 @@ def get_install_token(self):
26922686
hostname = self.mdict['pki_hostname']
26932687
subsystem = self.subsystem_type
26942688

2695-
sd_client = pki.system.SecurityDomainClient(self.sd_connection)
2696-
install_token = sd_client.get_install_token(hostname, subsystem)
2689+
sd_token_client = pki.system.SecurityDomainClient(self.sd_client)
2690+
install_token = sd_token_client.get_install_token(hostname, subsystem)
26972691

26982692
# Sleep for a bit to allow the install token to replicate to other clones.
26992693
# In the future this can be replaced with signed tokens.

0 commit comments

Comments
 (0)