Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add changelog fragment and address reviewer's comments
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Buzachis <abuzachis@redhat.com>
alinabuzachis committed May 25, 2022
1 parent 5bd5042 commit c7825cb
Showing 3 changed files with 9 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).
15 changes: 2 additions & 13 deletions plugins/lookup/aws_ssm.py
Original file line number Diff line number Diff line change
@@ -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:
@@ -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

@@ -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:
3 changes: 2 additions & 1 deletion tests/unit/plugins/lookup/test_aws_ssm.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c7825cb

Please sign in to comment.