Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSM.Client.get_document output returns carriage returns instead of new lines, makes document content unusable. #4294

Open
1 task
commandersqueaks opened this issue Oct 3, 2024 · 2 comments
Assignees
Labels
bug This issue is a confirmed bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue response-requested Waiting on additional information or feedback. ssm

Comments

@commandersqueaks
Copy link

Describe the bug

SSM.Client.get_document output returns carriage returns instead of new lines, makes document content unusable.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Script:
import boto3

client = boto3.client('ssm')
response = client.get_document(Name='AWSConfigRemediation-CancelKeyDeletion', DocumentFormat='YAML')
print(response)

Expected output:


schemaVersion: "0.3"
description: |

Document name - AWSConfigRemediation-CancelKeyDeletion

What does this document do?

This document cancels the deletion of specified AWS customer master key (CMK) using CancelKeyDeletion API.

Input Parameters

  • AutomationAssumeRole: (Required) The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf.
  • KeyId: (Required) The ID of the CMK you want to cancel deletion for.

Output Parameters

  • CancelKeyDeletion.CancelKeyDeletionResponse: The standard HTTP response from the CancelKeyDeletion API.

assumeRole: "{{ AutomationAssumeRole }}"
parameters:
AutomationAssumeRole:
type: AWS::IAM::Role::Arn
description: (Required) The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf.
KeyId:
type: String
description: (Required) The ID of the CMK you want to cancel deletion for.
allowedPattern: ^([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}|arn:(aws[a-zA-Z-]*)?:kms:[a-z0-9-]+:[0-9]{12}:key/)?[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
...etc

Current Behavior


{'Name': 'AWSConfigRemediation-CancelKeyDeletion', 'CreatedDate': datetime.datetime(2023, 9, 13, 8, 7, 5, 873000, tzinfo=tzlocal()), 'DocumentVersion': '3', 'Status': 'Active', 'Content': 'schemaVersion: "0.3"\ndescription: |\n ### Document name - AWSConfigRemediation-CancelKeyDeletion\n\n ## What does this document do?\n This document cancels the deletion of specified AWS customer master key (CMK) using [CancelKeyDeletion](https://doc (ARN) of the AWS Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf.\n * KeyId: (Required) The ID of the CMK you want to cancel deletion for.\n\n ## Output Parameters\n * CancelKeyDeletion.CancelKeyDeletionResponse: The standard HTTP response from the CancelKeyDeletion API.\n\nassumeRole: "{{ AutomationAssumeRole }}"\nparameters:\n AutomationAssumeRole:\n type: AWS::IAM::Role::Arn\n description: (Required) The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf.\n KeyId:\n type: String\n description: (Required) The ID of the CMK you want to cancel deletion for.\n allowedPattern: ^([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}|arn:(aws[a-zA-Z-]*)?:kms:[a-z0-9-]+:[0-9]{12}:key/)?[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
...etc

Reproduction Steps

Always same result.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.35.32

Environment details (OS name and version, etc.)

WSL Ubuntu, Amazon Linux 2

@commandersqueaks commandersqueaks added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Oct 3, 2024
@tim-finnigan tim-finnigan self-assigned this Oct 7, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reaching out. I don't see carriage returns (\r) in the response, but I do see newlines (\n). I think what is being returned here by the get_document command is expected. Also please note that the command makes a request to the underlying GetDocument API. If you view your debug logs (by adding boto3.set_stream_logger('') to your script) then you can see the raw API response being returned.

For reference I'll also share the Systems Manager User Guide page on working with SSM documents: https://docs.aws.amazon.com/systems-manager/latest/userguide/documents.html. Can you share more details on what you're trying to do and the issue you're running into?

@tim-finnigan tim-finnigan added response-requested Waiting on additional information or feedback. p2 This is a standard priority issue ssm and removed needs-triage This issue or PR still needs to be triaged. labels Oct 7, 2024
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue response-requested Waiting on additional information or feedback. ssm
Projects
None yet
Development

No branches or pull requests

2 participants