Skip to content

Commit

Permalink
lambda_info: remove unnecessary snake_casing of env_vars when queryin…
Browse files Browse the repository at this point in the history
…g lambda config (#1457) (#1479)

[manual backport stable-5] lambda_info: remove unnecessary snake_casing of env_vars when querying lambda config (#1457)

lambda_info: remove unnecessary snake_casing of env_vars when querying lambda config
SUMMARY
This PR modifies code to avoid converting environment variables to snake_case when querying config. Fixes #1412
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
lambda_info
ADDITIONAL INFORMATION
Reviewed-by: Mark Chappell
SUMMARY


ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell
  • Loading branch information
alinabuzachis authored Apr 26, 2023
1 parent aa6da23 commit 9f8f2ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- lambda_info - Do not convert environment variables to snake_case when querying lambda config. (https://github.com/ansible-collections/amazon.aws/pull/1457).
9 changes: 8 additions & 1 deletion plugins/modules/lambda_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,14 @@ def config_details(client, module, function_name):
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: # pylint: disable=duplicate-except
module.fail_json_aws(e, msg="Trying to get {0} configuration".format(function_name))

return camel_dict_to_snake_dict(lambda_info)
if "Environment" in lambda_info and "Variables" in lambda_info["Environment"]:
env_vars = lambda_info["Environment"]["Variables"]
snaked_lambda_info = camel_dict_to_snake_dict(lambda_info)
snaked_lambda_info["environment"]["variables"] = env_vars
else:
snaked_lambda_info = camel_dict_to_snake_dict(lambda_info)

return snaked_lambda_info


def mapping_details(client, module, function_name):
Expand Down

0 comments on commit 9f8f2ee

Please sign in to comment.