|
11 | 11 | from ocm_python_wrapper.ocm_client import OCMPythonClient |
12 | 12 | from simple_logger.logger import get_logger |
13 | 13 |
|
14 | | - |
15 | 14 | LOGGER = get_logger(name=__name__) |
16 | 15 | TIMEOUT_5MIN = 5 * 60 |
17 | 16 |
|
@@ -52,15 +51,14 @@ def rosa_login(env, token, aws_region, allowed_commands=None): |
52 | 51 |
|
53 | 52 | try: |
54 | 53 | 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 | | - |
58 | 54 | except NotLoggedInOrWrongEnvError: |
59 | 55 | build_execute_command( |
60 | 56 | command=f"login --env={env} --token={token}", |
61 | 57 | allowed_commands=_allowed_commands, |
62 | 58 | ) |
63 | 59 | 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}].") |
64 | 62 |
|
65 | 63 |
|
66 | 64 | def rosa_logout(allowed_commands=None): |
@@ -102,7 +100,7 @@ def execute_command(command, wait_timeout=TIMEOUT_5MIN): |
102 | 100 | log = f"Executing command: {' '.join(command)}, waiting for {wait_timeout} seconds." |
103 | 101 | hashed_log = hash_log_keys(log=log) |
104 | 102 | 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) |
106 | 104 | if res.returncode != 0: |
107 | 105 | raise CommandExecuteError(f"Failed to execute '{hashed_log}': {res.stderr}") |
108 | 106 |
|
|
0 commit comments