Skip to content

Commit 2d4e8da

Browse files
[pre-commit.ci] pre-commit autoupdate (#451)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.1 → v0.15.2](astral-sh/ruff-pre-commit@v0.15.1...v0.15.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: resolve ruff v0.15.2 linting errors --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Meni Yakove <myakove@gmail.com>
1 parent 47fa0fa commit 2d4e8da

6 files changed

Lines changed: 11 additions & 14 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
- id: detect-secrets
3232

3333
- repo: https://github.com/astral-sh/ruff-pre-commit
34-
rev: v0.15.1
34+
rev: v0.15.2
3535
hooks:
3636
- id: ruff
3737
- id: ruff-format

rosa/cli.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from ocm_python_wrapper.ocm_client import OCMPythonClient
1212
from simple_logger.logger import get_logger
1313

14-
1514
LOGGER = get_logger(name=__name__)
1615
TIMEOUT_5MIN = 5 * 60
1716

@@ -52,15 +51,14 @@ def rosa_login(env, token, aws_region, allowed_commands=None):
5251

5352
try:
5453
is_logged_in(allowed_commands=_allowed_commands, aws_region=aws_region, env=env)
55-
LOGGER.info(f"Already logged in to {env} [region: {aws_region}].")
56-
return
57-
5854
except NotLoggedInOrWrongEnvError:
5955
build_execute_command(
6056
command=f"login --env={env} --token={token}",
6157
allowed_commands=_allowed_commands,
6258
)
6359
is_logged_in(allowed_commands=_allowed_commands, aws_region=aws_region, env=env)
60+
else:
61+
LOGGER.info(f"Already logged in to {env} [region: {aws_region}].")
6462

6563

6664
def rosa_logout(allowed_commands=None):
@@ -102,7 +100,7 @@ def execute_command(command, wait_timeout=TIMEOUT_5MIN):
102100
log = f"Executing command: {' '.join(command)}, waiting for {wait_timeout} seconds."
103101
hashed_log = hash_log_keys(log=log)
104102
LOGGER.info(hashed_log)
105-
res = subprocess.run(command, capture_output=True, text=True, timeout=wait_timeout)
103+
res = subprocess.run(command, capture_output=True, text=True, timeout=wait_timeout, check=False)
106104
if res.returncode != 0:
107105
raise CommandExecuteError(f"Failed to execute '{hashed_log}': {res.stderr}")
108106

rosa/rosa_versions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import re
2-
from typing import Dict, List
32
from functools import lru_cache
43

5-
import rosa.cli
64
from ocm_python_wrapper.ocm_client import OCMPythonClient
75

6+
import rosa.cli
7+
88

99
@lru_cache
1010
def get_rosa_versions(
1111
ocm_client: OCMPythonClient, aws_region: str, channel_group: str = "stable", hosted_cp: bool = False
12-
) -> Dict[str, Dict[str, List[str]]]:
12+
) -> dict[str, dict[str, list[str]]]:
1313
"""
1414
Get all rosa versions for specified channel group.
1515
@@ -29,13 +29,13 @@ def get_rosa_versions(
2929
'4.15': ['4.15.32', '4.15.31', '4.15.30', '4.15.29', '4.15.28', '4.15.27']}}
3030
3131
"""
32-
rosa_base_available_versions_dict: Dict = {}
32+
rosa_base_available_versions_dict: dict = {}
3333
base_available_versions = rosa.cli.execute(
3434
command=(f"list versions --channel-group={channel_group} {'--hosted-cp' if hosted_cp else ''}"),
3535
aws_region=aws_region,
3636
ocm_client=ocm_client,
3737
)["out"]
38-
_all_versions: List = [ver["raw_id"] for ver in base_available_versions]
38+
_all_versions: list = [ver["raw_id"] for ver in base_available_versions]
3939
rosa_base_available_versions_dict[channel_group] = {}
4040
for _version in _all_versions:
4141
_version_key = re.findall(r"^\d+.\d+", _version)[0]

rosa/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def path_from_dict(_dict=None, _path=""):
88
for key, val in _dict.items():
99
# If dict == end_values we need to test it
1010
if isinstance(val, dict):
11-
if all([_key in end_values for _key in val.keys()]):
11+
if all(_key in end_values for _key in val):
1212
yield {
1313
"command": f"{_path}{key}",
1414
AWS_REGION_STR: AWS_REGION_STR if val["region"] else None,

rosa/tests/test_parse_command.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from rosa.cli import build_command, parse_help
66
from rosa.tests.const import AWS_REGION_STR
77

8-
98
LOGGER = get_logger(name=__name__)
109

1110

rosa/tests/test_rosa_login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
2-
from rosa.cli import is_logged_in, NotLoggedInOrWrongEnvError
32

3+
from rosa.cli import NotLoggedInOrWrongEnvError, is_logged_in
44

55
ROSA_ENV = "rosa_env"
66
AWS_REGION_STR = "us-east-1"

0 commit comments

Comments
 (0)