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

Commit c3d0059

Browse files
committed
bugfix: allow hybrid worker groups with spaces
1 parent 679aa36 commit c3d0059

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Providers/nxOMSAutomationWorker/automationworker/3.x/worker/jrdsclient.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from datetime import datetime
99
import time
1010
import traceback
11+
import urllib.parse
1112

1213

1314
import configuration3 as configuration
@@ -69,8 +70,9 @@ def get_sandbox_actions(self):
6970
}
7071
]
7172
"""
73+
encoded_hybrid_worker_group_name = urllib.parse.quote(self.HybridWorkerGroupName)
7274
url = self.base_uri + "/automationAccounts/" + self.account_id + \
73-
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + self.HybridWorkerGroupName + \
75+
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + encoded_hybrid_worker_group_name + \
7476
"&api-version=" + self.protocol_version
7577
response = self.issue_request(lambda u: self.httpClient.get(u), url)
7678

@@ -84,13 +86,13 @@ def get_sandbox_actions(self):
8486
except TypeError:
8587
locallogger.log_info("INFO: Could not deserialize get_sandbox_actions response body: %s" % str(response.deserialized_data))
8688
return None
87-
89+
8890
# 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
8991
# based on the headers client initiates worker certificate rotation
9092
try:
9193
if(eval(workercertificaterotation.get_certificate_rotation_header_value())):
9294
tracer.log_debug_trace("Initiating certificate Rotation of Hybrid Worker")
93-
workercertificaterotation.set_certificate_rotation_header_value(DISABLE_CERT_ROTATION)
95+
workercertificaterotation.set_certificate_rotation_header_value(DISABLE_CERT_ROTATION)
9496
self.worker_certificate_rotation()
9597
tracer.log_worker_certificate_rotation_successful()
9698
except Exception as ex:
@@ -102,7 +104,7 @@ def get_sandbox_actions(self):
102104
raise Exception("Unable to get sandbox actions. [status=" + str(response.status_code) + "]")
103105

104106
def worker_certificate_rotation(self):
105-
""" Rotate worker certificate.
107+
""" Rotate worker certificate.
106108
Steps includes creating new certificate/key and after JRDS returns 200, replace the old certificate/key with newly generated certificate/key.
107109
Worker.conf is updated with the latest thumbprint.
108110
"""

Providers/nxOMSAutomationWorker/automationworker/worker/jrdsclient.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from datetime import datetime
88
import time
99
import traceback
10+
import urllib.parse
1011

1112

1213
import configuration
@@ -68,8 +69,9 @@ def get_sandbox_actions(self):
6869
}
6970
]
7071
"""
72+
encoded_hybrid_worker_group_name = urllib.parse.quote(self.HybridWorkerGroupName)
7173
url = self.base_uri + "/automationAccounts/" + self.account_id + \
72-
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + self.HybridWorkerGroupName + \
74+
"/Sandboxes/GetSandboxActions?HybridWorkerGroupName=" + encoded_hybrid_worker_group_name + \
7375
"&api-version=" + self.protocol_version
7476
response = self.issue_request(lambda u: self.httpClient.get(u), url)
7577

@@ -105,7 +107,7 @@ def get_sandbox_actions(self):
105107

106108

107109
def worker_certificate_rotation(self):
108-
""" Rotate worker certificate.
110+
""" Rotate worker certificate.
109111
Steps includes creating new certificate/key and after JRDS returns 200, replace the old certificate/key with newly generated certificate/key.
110112
Worker.conf is updated with the latest thumbprint.
111113
"""

0 commit comments

Comments
 (0)