Skip to content

Commit 70bbe33

Browse files
committed
Check API key and add comments
1 parent 59c7e88 commit 70bbe33

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

jenkins_pipelines/scripts/bsc_list_generator/bsc_finder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def parse_cli_args() -> argparse.Namespace:
4343
def get_bugzilla_product(product_version: str, cloud: bool) -> str:
4444
return f"SUSE Manager {product_version}{' in Public Clouds' if cloud else ''}"
4545

46+
# return a txt file formatted according to .md syntax, so that it can be used in GitHub cards and the likes
4647
def bugs_to_links_list(products_bugs: dict[str, list[dict]], bugzilla_url: str) -> list[str]:
4748
lines: list[str] = []
4849

@@ -78,6 +79,7 @@ def main():
7879

7980
if args.all:
8081
for version in _PRODUCT_VERSIONS:
82+
# get both "standard" and cloud product versions
8183
bugzilla_products.append(get_bugzilla_product(version, False))
8284
bugzilla_products.append(get_bugzilla_product(version, True))
8385
else:

jenkins_pipelines/scripts/bsc_list_generator/bugzilla_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
class BugzillaClient:
77

8+
# api_key is needed for actual API calls
89
def __init__(self, api_key: str, base_url: str = _SUSE_BUGZILLA_BASE_URL, api_type: str = "rest"):
10+
if not api_key:
11+
raise ValueError("api_key is None or empty")
912
# private
1013
self._api_key: str = api_key
1114
self._base_url: str = base_url
@@ -16,6 +19,7 @@ def __init__(self, api_key: str, base_url: str = _SUSE_BUGZILLA_BASE_URL, api_ty
1619
self.show_bug_url: str = f"{base_url}/show_bug.cgi"
1720

1821
def get_bugs(self, **kwargs) -> list[dict[str, Any]]:
22+
# drops CLI args that have not beend used and have no default
1923
additional_params: dict[str, Any] = { k: v for k, v in kwargs.items() if v is not None }
2024
response: requests.Response = requests.get(self._bugs_endpoint, params={**self._params, **additional_params})
2125
if not response.ok:

0 commit comments

Comments
 (0)