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

iam_role_info - confusing ValidationError when passed path without / prefix/suffix #2065

Closed
1 task done
tremble opened this issue Apr 29, 2024 · 1 comment · Fixed by #2066
Closed
1 task done

iam_role_info - confusing ValidationError when passed path without / prefix/suffix #2065

tremble opened this issue Apr 29, 2024 · 1 comment · Fixed by #2066

Comments

@tremble
Copy link
Contributor

tremble commented Apr 29, 2024

Summary

During the refactor the iam_role_info code for handling paths missing the / prefix/suffix was modified, with the final update to the variable using a normal string instead of an f-string. This results in junk being passed as the path_prefix rather than the path with / as both a prefix and a suffix.

Did you mean to use an f-string here? If you do it like this you'll get a ValidationError, because path_prefix starts with a litteral {:

The specified value for pathPrefix is invalid. It must begin with the / character and contain only alphanumeric characters and/or / characters.

Originally posted by @vonschultz in #1998 (comment)

Issue Type

Bug Report

Component Name

iam_role_info

Ansible Version

(CI)

Collection Versions

(CI)

AWS SDK versions

(CI)

Configuration

(CI)

OS / Environment

CentOS

Steps to Reproduce

- iam_role_info:
    path_prefix: "example_path"

Expected Results

Searches for IAM roles with a path of /example_path/

Actual Results

The specified value for pathPrefix is invalid. It must begin with the / character and contain only alphanumeric characters and/or / characters.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@tremble
Copy link
Contributor Author

tremble commented Apr 29, 2024

Work around is simply to pass the "correct" prefix including a / at the start and end of the path.

softwarefactory-project-zuul bot pushed a commit that referenced this issue Apr 30, 2024
iam_role_info - fix bug in prefix_path handling of missing /s

SUMMARY
fixes: #2065
When updating the code in iam_role_info to handle missing / at the start/end of prefix_path, the string as finally built should be an f-string not a simple string/
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role_info
ADDITIONAL INFORMATION
Thanks to vonschultz  for catching this one.

Reviewed-by: Alina Buzachis
patchback bot pushed a commit that referenced this issue Apr 30, 2024
iam_role_info - fix bug in prefix_path handling of missing /s

SUMMARY
fixes: #2065
When updating the code in iam_role_info to handle missing / at the start/end of prefix_path, the string as finally built should be an f-string not a simple string/
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role_info
ADDITIONAL INFORMATION
Thanks to vonschultz  for catching this one.

Reviewed-by: Alina Buzachis
(cherry picked from commit a92f03a)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Apr 30, 2024
…2069)

[PR #2066/a92f03ad backport][stable-7] iam_role_info - fix bug in prefix_path handling of missing /s

This is a backport of PR #2066 as merged into main (a92f03a).
SUMMARY
fixes: #2065
When updating the code in iam_role_info to handle missing / at the start/end of prefix_path, the string as finally built should be an f-string not a simple string/
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role_info
ADDITIONAL INFORMATION
Thanks to vonschultz  for catching this one.

Reviewed-by: Mark Chappell
abraverm pushed a commit to abraverm/amazon.aws that referenced this issue May 2, 2024
…ollections#2066)

iam_role_info - fix bug in prefix_path handling of missing /s

SUMMARY
fixes: ansible-collections#2065
When updating the code in iam_role_info to handle missing / at the start/end of prefix_path, the string as finally built should be an f-string not a simple string/
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role_info
ADDITIONAL INFORMATION
Thanks to vonschultz  for catching this one.

Reviewed-by: Alina Buzachis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant