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

pull-arguments adding quotes to arguments #1579

Closed
branic opened this issue Jul 20, 2023 · 0 comments · Fixed by #1590
Closed

pull-arguments adding quotes to arguments #1579

branic opened this issue Jul 20, 2023 · 0 comments · Fixed by #1590
Assignees
Labels
bug Researched, reproducible, committed to fix

Comments

@branic
Copy link

branic commented Jul 20, 2023

ISSUE TYPE
  • Bug Report
SUMMARY

If the ansible-navigator needs to pull the defined EE container image the pull is not successful if the pull arguments uses an environment variable (e.g. ${HOME)).

ANSIBLE-NAVIGATOR VERSION
ansible-navigator 3.4.0
CONFIGURATION
ansible-navigator:
  execution-environment:
    image: quay.io/branic/my-aws-ee:latest
    pull:
      arguments:
        - "--authfile ${HOME}/path/to/auth_file.json"
      policy: missing
LOG FILE
----------------------------------------------------------------------------------------------------
Execution environment image and pull policy overview
----------------------------------------------------------------------------------------------------
Execution environment image name:     quay.io/branic/my-aws-ee:latest
Execution environment image tag:      latest
Execution environment pull arguments: '--authfile ${HOME}/path/to/auth_file.json'
Execution environment pull policy:    missing
Execution environment pull needed:    True
----------------------------------------------------------------------------------------------------
Updating the execution environment
----------------------------------------------------------------------------------------------------
Running the command: podman pull --authfile '${HOME}/path/to/auth_file.json' quay.io/branic/my-aws-ee:latest
Error: stat ${HOME}/path/to/auth_file.json: no such file or directory
Error: initializing source docker://quay.io/branic/my-aws-ee:latest: reading manifest latest in quay.io/branic/my-aws-ee: unauthorized: access to the requested resource is not authorized
Please review the log for errors.

Notice that the Error line is reporting ${HOME} instead of the expanding the variable contents (e.g. /home/my_username).

STEPS TO REPRODUCE
  1. Create an EE that is in a registry that needs authentication to pull the image
  2. Use the above defined ansible-navigator config file and replace the path to the registry authorization file, ensuring that an environment variable is used in the path.
  3. Use ansible-navigator to run a playbook causing ansible-navigator to try and pull the image
EXPECTED RESULTS

ansible-navigator is able to pull the image

ACTUAL RESULTS

ansible-navigator failed to pull the image due to the ' around the arguments causing the shell to not expand the the variable (${HOME}).

ADDITIONAL INFORMATION

The error can be reproduced with podman running the same exact command.

podman pull --authfile '${HOME}/path/to/auth_file.json' quay.io/branic/my-aws-ee:latest
Error: stat ${HOME}/path/to/auth_file.json: no such file or directory

Removing the ' around the argument allows podman to pull the image.

Also, removing the quotes in the config file (e.g. changing - "--authfile ${HOME}/path/to/auth_file.json" to - --authfile ${HOME}/path/to/auth_file.json) has no effect on the command that anisble-navigator runs.

@branic branic added bug Researched, reproducible, committed to fix new New issues and PRs to triaged labels Jul 20, 2023
@shatakshiiii shatakshiiii removed the new New issues and PRs to triaged label Jul 26, 2023
@shatakshiiii shatakshiiii self-assigned this Aug 2, 2023
@ssbarnea ssbarnea moved this to In Progress in 🧰 devtools project board Sep 18, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 🧰 devtools project board Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Researched, reproducible, committed to fix
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants