From 9a36dffb629dba618485330c5b96f10256196598 Mon Sep 17 00:00:00 2001 From: dlscjf151 Date: Tue, 14 May 2024 18:30:47 +0900 Subject: [PATCH 1/2] fix: set access_key, session_token if profile is not provided --- plugins/connection/aws_ssm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 5c2d6d57788..e3a00c77bd6 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -804,13 +804,14 @@ def _get_boto_client(self, service, region_name=None, profile_name=None, endpoin aws_session_token = self.get_option("session_token") session_args = dict( - aws_access_key_id=aws_access_key_id, - aws_secret_access_key=aws_secret_access_key, - aws_session_token=aws_session_token, region_name=region_name, ) if profile_name: session_args["profile_name"] = profile_name + else: + session_args["aws_access_key_id"] = aws_access_key_id, + session_args["aws_secret_access_key"] = aws_secret_access_key, + session_args["aws_session_token"] = aws_session_token, session = boto3.session.Session(**session_args) client = session.client( From 737e2f8545e5985bdb2a4c5e226eb9f784271b87 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Tue, 18 Jun 2024 15:39:03 +0200 Subject: [PATCH 2/2] fix bad C&P --- plugins/connection/aws_ssm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index e3a00c77bd6..c797c3a95bf 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -809,9 +809,9 @@ def _get_boto_client(self, service, region_name=None, profile_name=None, endpoin if profile_name: session_args["profile_name"] = profile_name else: - session_args["aws_access_key_id"] = aws_access_key_id, - session_args["aws_secret_access_key"] = aws_secret_access_key, - session_args["aws_session_token"] = aws_session_token, + session_args["aws_access_key_id"] = aws_access_key_id + session_args["aws_secret_access_key"] = aws_secret_access_key + session_args["aws_session_token"] = aws_session_token session = boto3.session.Session(**session_args) client = session.client(