Skip to content

Commit 0510910

Browse files
committed
Run ruff format & ruff check
1 parent 7a26c0a commit 0510910

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

apps/src/jenkins-job-builder.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def get_platform_metadata():
3333
Creates a dict containing display name and version list for a given platform.
3434
"""
3535
return {
36-
p["id"]: {"name": p["name"], "versions": [v for v in p["versions"]]}
37-
for p in catalog.platforms
36+
p["id"]: {"name": p["name"], "versions": dict(p["versions"])} for p in catalog.platforms
3837
}
3938

4039

@@ -143,17 +142,30 @@ def execute_jjb():
143142
"""
144143
exit_code = os.system("jenkins-jobs --conf /jjb/jjb.conf update /jjb/maintenance.yaml")
145144
if exit_code != 0:
146-
print(f"ERROR: jenkins-jobs failed for maintenance.yaml with exit code {exit_code}", file=sys.stderr)
145+
print(
146+
f"ERROR: jenkins-jobs failed for maintenance.yaml with exit code {exit_code}",
147+
file=sys.stderr,
148+
)
147149
sys.exit(1)
148150

149-
exit_code = os.system("jenkins-jobs --conf /jjb/jjb.conf update /jjb/operator_weekly_tests.yaml")
151+
exit_code = os.system(
152+
"jenkins-jobs --conf /jjb/jjb.conf update /jjb/operator_weekly_tests.yaml"
153+
)
150154
if exit_code != 0:
151-
print(f"ERROR: jenkins-jobs failed for operator_weekly_tests.yaml with exit code {exit_code}", file=sys.stderr)
155+
print(
156+
f"ERROR: jenkins-jobs failed for operator_weekly_tests.yaml with exit code {exit_code}",
157+
file=sys.stderr,
158+
)
152159
sys.exit(1)
153160

154-
exit_code = os.system("jenkins-jobs --conf /jjb/jjb.conf update /jjb/operator_custom_tests.yaml")
161+
exit_code = os.system(
162+
"jenkins-jobs --conf /jjb/jjb.conf update /jjb/operator_custom_tests.yaml"
163+
)
155164
if exit_code != 0:
156-
print(f"ERROR: jenkins-jobs failed for operator_custom_tests.yaml with exit code {exit_code}", file=sys.stderr)
165+
print(
166+
f"ERROR: jenkins-jobs failed for operator_custom_tests.yaml with exit code {exit_code}",
167+
file=sys.stderr,
168+
)
157169
sys.exit(1)
158170

159171

apps/src/modules/catalog.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ def get_auto_retry_config(operator_id):
194194
operator_test = get_operator_test(operator_id)
195195

196196
# Default configuration
197-
default_config = {"attempts_parallel": 0, "attempts_serial": 3, "delete_failed_namespaces": True}
197+
default_config = {
198+
"attempts_parallel": 0,
199+
"attempts_serial": 3,
200+
"delete_failed_namespaces": True,
201+
}
198202

199203
if not operator_test or "auto_retry" not in operator_test:
200204
return default_config

apps/src/modules/provider_replicated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def get_cluster(name):
6767
Get cluster by name
6868
"""
6969
clusters = get_clusters()
70-
return clusters[name] if name in clusters else None
70+
return clusters.get(name, None)
7171

7272

7373
def wait_for_running_cluster(name, logger):

apps/src/operator-test-runner.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ def log(msg=""):
161161
timestamp = f"{datetime.now(UTC):%Y-%m-%d %H:%M:%S}"
162162
print(f"{timestamp} :: {msg}")
163163
sys.stdout.flush()
164-
f = open(TESTDRIVER_LOGFILE, "a")
165-
f.write(f"{timestamp} :: {msg}\n")
166-
f.close()
164+
with open(TESTDRIVER_LOGFILE, "a") as f:
165+
f.write(f"{timestamp} :: {msg}\n")
167166

168167

169168
def clone_git_repo(repo):
@@ -193,13 +192,13 @@ def run_tests(operator, operator_version, test_script_params):
193192
"""
194193

195194
# Get test script configuration - check for runtime override first
196-
test_script_override = os.environ.get('TEST_SCRIPT', '').strip()
195+
test_script_override = os.environ.get("TEST_SCRIPT", "").strip()
197196

198-
if test_script_override == 'Auto-retry':
199-
test_script = 'auto-retry-tests.py'
197+
if test_script_override == "Auto-retry":
198+
test_script = "auto-retry-tests.py"
200199
log(f"Using test script: {test_script} (user override)")
201-
elif test_script_override == 'run-tests':
202-
test_script = 'run-tests'
200+
elif test_script_override == "run-tests":
201+
test_script = "run-tests"
203202
log(f"Using test script: {test_script} (user override)")
204203
else:
205204
# Default or empty - use catalog configuration
@@ -235,7 +234,7 @@ def run_tests(operator, operator_version, test_script_params):
235234
parts = test_script_params.split("--parallel")
236235
if len(parts) > 1:
237236
parallel_value = parts[1].strip().split()[0]
238-
except:
237+
except Exception:
239238
pass
240239

241240
# Build command for auto-retry-tests.py

0 commit comments

Comments
 (0)