Skip to content

Commit

Permalink
Avoid possibility of thread race conditions with concurrent generator…
Browse files Browse the repository at this point in the history
…s on global list structures.
  • Loading branch information
GrahamDumpleton committed Jul 14, 2022
1 parent e8f49ab commit 8c12195
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions session-manager/handlers/kyverno_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def kyverno_environment_rules(workshop_spec, environment_name):

rules = []

for clusterpolicy in kyverno_policies:
for clusterpolicy in list(kyverno_policies):
policy_name = xget(clusterpolicy, "metadata.name")
policy_rules = xget(clusterpolicy, "spec.rules", [])
policy_rules = list(xget(clusterpolicy, "spec.rules", []))

for index, rule in enumerate(policy_rules, start=1):
rule = copy.deepcopy(rule)
Expand Down
2 changes: 1 addition & 1 deletion session-manager/handlers/operator_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def image_reference(name):
version = xget(config_values, "version", "latest")
image = f"{IMAGE_REPOSITORY}/educates-{name}:{version}"
image_versions = xget(config_values, "imageVersions", [])
for item in image_versions:
for item in list(image_versions):
if item["name"] == name:
image = item["image"]
break
Expand Down
2 changes: 1 addition & 1 deletion session-manager/handlers/workshopenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def workshop_environment_create(name, body, meta, spec, status, patch, logger, *
ipv4_blockcidrs = []
ipv6_blockcidrs = []

for block in NETWORK_BLOCKCIDRS:
for block in list(NETWORK_BLOCKCIDRS):
if ":" in block:
ipv6_blockcidrs.append(block)
else:
Expand Down
2 changes: 1 addition & 1 deletion session-manager/handlers/workshopsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _setup_session_namespace(
ipv4_blockcidrs = []
ipv6_blockcidrs = []

for block in NETWORK_BLOCKCIDRS:
for block in list(NETWORK_BLOCKCIDRS):
if ":" in block:
ipv6_blockcidrs.append(block)
else:
Expand Down

0 comments on commit 8c12195

Please sign in to comment.