Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
bugfix: allow hybrid worker groups with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwbarnett committed Aug 4, 2023
1 parent 679aa36 commit c3d0059
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from datetime import datetime
import time
import traceback
import urllib.parse


import configuration3 as configuration
Expand Down Expand Up @@ -69,8 +70,9 @@ def get_sandbox_actions(self):
}
]
"""
encoded_hybrid_worker_group_name = urllib.parse.quote(self.HybridWorkerGroupName)
url = self.base_uri + "/automationAccounts/" + self.account_id + \
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + self.HybridWorkerGroupName + \
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + encoded_hybrid_worker_group_name + \
"&api-version=" + self.protocol_version
response = self.issue_request(lambda u: self.httpClient.get(u), url)

Expand All @@ -84,13 +86,13 @@ def get_sandbox_actions(self):
except TypeError:
locallogger.log_info("INFO: Could not deserialize get_sandbox_actions response body: %s" % str(response.deserialized_data))
return None

# whenever worker cert has crossed half of it's lifetime or server is initiating a forced rotation of certificate based on date, header is set on the server side
# based on the headers client initiates worker certificate rotation
try:
if(eval(workercertificaterotation.get_certificate_rotation_header_value())):
tracer.log_debug_trace("Initiating certificate Rotation of Hybrid Worker")
workercertificaterotation.set_certificate_rotation_header_value(DISABLE_CERT_ROTATION)
workercertificaterotation.set_certificate_rotation_header_value(DISABLE_CERT_ROTATION)
self.worker_certificate_rotation()
tracer.log_worker_certificate_rotation_successful()
except Exception as ex:
Expand All @@ -102,7 +104,7 @@ def get_sandbox_actions(self):
raise Exception("Unable to get sandbox actions. [status=" + str(response.status_code) + "]")

def worker_certificate_rotation(self):
""" Rotate worker certificate.
""" Rotate worker certificate.
Steps includes creating new certificate/key and after JRDS returns 200, replace the old certificate/key with newly generated certificate/key.
Worker.conf is updated with the latest thumbprint.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from datetime import datetime
import time
import traceback
import urllib.parse


import configuration
Expand Down Expand Up @@ -68,8 +69,9 @@ def get_sandbox_actions(self):
}
]
"""
encoded_hybrid_worker_group_name = urllib.parse.quote(self.HybridWorkerGroupName)
url = self.base_uri + "/automationAccounts/" + self.account_id + \
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + self.HybridWorkerGroupName + \
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + encoded_hybrid_worker_group_name + \
"&api-version=" + self.protocol_version
response = self.issue_request(lambda u: self.httpClient.get(u), url)

Expand Down Expand Up @@ -105,7 +107,7 @@ def get_sandbox_actions(self):


def worker_certificate_rotation(self):
""" Rotate worker certificate.
""" Rotate worker certificate.
Steps includes creating new certificate/key and after JRDS returns 200, replace the old certificate/key with newly generated certificate/key.
Worker.conf is updated with the latest thumbprint.
"""
Expand Down

0 comments on commit c3d0059

Please sign in to comment.