Skip to content

Commit

Permalink
Add changelog fragment and address reviewer's comments
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Buzachis <[email protected]>
  • Loading branch information
alinabuzachis committed May 25, 2022
1 parent 5bd5042 commit ba41e81
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
5 changes: 5 additions & 0 deletions changelogs/fragments/623-aws_ssm-envars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
minor_changes:
- aws_ssm: Add support for ``endpoint`` parameter (https://github.com/ansible-collections/amazon.aws/pull/623).

bugfixes:
- aws_ssm: Fix environment variables for client configuration (e.g., AWS_PROFILE, AWS_ACCESS_KEY_ID) (https://github.com/ansible-collections/amazon.aws/pull/623).
5 changes: 5 additions & 0 deletions changelogs/fragments/837-aws_ssm-envars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
minor_changes:
- aws_ssm: Add support for ``endpoint`` parameter (https://github.com/ansible-collections/amazon.aws/pull/837).

bugfixes:
- aws_ssm: Fix environment variables for client configuration (e.g., AWS_PROFILE, AWS_ACCESS_KEY_ID) (https://github.com/ansible-collections/amazon.aws/pull/837).
15 changes: 2 additions & 13 deletions plugins/lookup/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
choices: ['error', 'skip', 'warn']
version_added: 2.0.0
endpoint:
description: Use a custom endpoint when connecting to SSM service
description: Use a custom endpoint when connecting to SSM service.
type: string
version_added: 3.4.0
extends_documentation_fragment:
Expand Down Expand Up @@ -211,15 +211,7 @@ def run(self, terms, variables=None, boto_profile=None, aws_profile=None,
endpoint=cli_endpoint,
))

try:
client = boto3_conn(module=self, **cli_boto_params)
except (
botocore.exceptions.ProfileNotFound,
botocore.exceptions.PartialCredentialsError,
botocore.exceptions.ClientError,
botocore.exceptions.ParamValidationError,
):
raise AnsibleError("Insufficient credentials found.")
client = boto3_conn(module=self, **cli_boto_params)

ssm_dict['WithDecryption'] = decrypt

Expand Down Expand Up @@ -274,9 +266,6 @@ def get_path_parameters(self, client, ssm_dict, term, on_missing, on_denied):

return paramlist

def fail_json(self, msg, **kwargs):
raise AnsibleError(msg)

def get_parameter_value(self, client, ssm_dict, term, on_missing, on_denied):
ssm_dict["Name"] = term
try:
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/lookup/test_aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
from unittest.mock import ANY

__metaclass__ = type

import pytest
from unittest.mock import ANY
from copy import copy

from ansible.errors import AnsibleError
Expand Down

0 comments on commit ba41e81

Please sign in to comment.