You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/08/02 14:33:11 UTC
[airflow] branch main updated: Add logging information in _fetch_from_ssm (#25401)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 10b198ac5b Add logging information in _fetch_from_ssm (#25401)
10b198ac5b is described below
commit 10b198ac5b8451bf753f4a53ef59907d47005d96
Author: Vincent <97...@users.noreply.github.com>
AuthorDate: Tue Aug 2 10:32:48 2022 -0400
Add logging information in _fetch_from_ssm (#25401)
---
tests/system/providers/amazon/aws/utils/__init__.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/system/providers/amazon/aws/utils/__init__.py b/tests/system/providers/amazon/aws/utils/__init__.py
index f554d6d1cb..a8492ea09b 100644
--- a/tests/system/providers/amazon/aws/utils/__init__.py
+++ b/tests/system/providers/amazon/aws/utils/__init__.py
@@ -17,6 +17,7 @@
import inspect
import json
+import logging
import os
from os.path import basename, splitext
from typing import List, Optional, Tuple
@@ -47,6 +48,8 @@ LOWERCASE_ENV_ID_MSG: str = (
)
NO_VALUE_MSG: str = 'No Value Found: Variable {key} could not be found and no default value was provided.'
+log = logging.getLogger(__name__)
+
def _get_test_name() -> str:
"""
@@ -93,15 +96,12 @@ def _fetch_from_ssm(key: str, test_name: Optional[str] = None) -> str:
try:
value = json.loads(ssm_client.get_parameter(Name=_test_name)['Parameter']['Value'])[key]
# Since a default value after the SSM check is allowed, these exceptions should not stop execution.
- except NoCredentialsError:
- # No boto credentials found.
- pass
- except ssm_client.exceptions.ParameterNotFound:
- # SSM does not contain any values for this test.
- pass
- except KeyError:
- # SSM contains values for this test, but not the requested value.
- pass
+ except NoCredentialsError as e:
+ log.info("No boto credentials found: %s", e)
+ except ssm_client.exceptions.ParameterNotFound as e:
+ log.info("SSM does not contain any parameter for this test: %s", e)
+ except KeyError as e:
+ log.info("SSM contains one parameter for this test, but not the requested value: %s", e)
return value