aws / aws/aws-cli

`aws sqs list-queue-tags` outputs unexpected format with `--output-text`

Open
#7,839 2 comments 0 reactions 0 assignees View on GitHub
feature-request p2 sqs
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### Describe the bug

This is SQS team, we recently got a customer reporting unexpected output format when using `--output text` flag.
When querying `list-queue-tags` command without any flag, the output is as expected
```
aws sqs list-queue-tags --queue-url https://sqs.us-east-1.amazonaws.com/xxxxxxxxxxx/DLQ
{
"Tags": {
"hi": "test2",
"hello": "test"
}
}
```

When using the `--output -text` flag, the output becomes
```
aws sqs list-queue-tags --queue-url https://sqs.us-east-1.amazonaws.com/xxxxxxxxxxxxx/DLQ --output text
TAGS test test2
```
It only displays the values of each tag.

This behavior is reproducible and we suspect this bug comes from [this line](https://github.com/aws/aws-cli/blob/develop/awscli/text.py#L20).

### Expected Behavior

```
aws sqs list-queue-tags --queue-url https://sqs.us-east-1.amazonaws.com/xxxxxxxxxxx/DLQ --output text
{
"Tags": {
"hi": "test2",
"hello": "test"
}
}
```

'Tags': [{'Key': 'testKey2', 'Value': 'testValue2'}, {'Key': 'testKey', 'Value': 'testValue'}]

### Current Behavior

```
aws sqs list-queue-tags --queue-url https://sqs.us-east-1.amazonaws.com/xxxxxxxxxxxxx/DLQ --output text
TAGS test test2
```

### Reproduction Steps

```
aws sqs list-queue-tags --queue-url https://sqs.us-east-1.amazonaws.com/xxxxxxxxxxxxx/DLQ --output text
```

### Possible Solution

https://github.com/aws/aws-cli/blob/develop/awscli/text.py#L20
Check if the response contains a Tags attribute, and that Tags attribute is not formatted as a list of dictionaries, then change it

### Additional Information/Context

_No response_

### CLI version used

2.11.11

### Environment details (OS name and version, etc.)

MacOS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.