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

volume-mounts replace symlinks with full path for both src and dest #1859

Open
MallocArray opened this issue Oct 3, 2024 · 1 comment
Open
Labels
bug Researched, reproducible, committed to fix

Comments

@MallocArray
Copy link

ISSUE TYPE
  • Bug Report
SUMMARY

When setting a dest: path that is a symlink on the host device, it is converted to the host's local path inside of the EE instead of the container's

ANSIBLE-NAVIGATOR VERSION
ansible-navigator 24.9.0
CONFIGURATION
ansible-navigator:
  execution-environment:
    volume-mounts:
      - src: /root/.azure
        dest: /root/.azure
LOG FILE

Relevant entry:

2024-10-02T20:52:57.214842+00:00 DEBUG 'ansible_navigator.main'  before: '[{'src': '/root/.azure', 'dest': '/root/.azure'}]'
2024-10-02T20:52:57.214866+00:00 DEBUG 'ansible_navigator.main'  after: '['/mnt/c/Users/username/.azure:/mnt/c/Users/username/.azure']'
STEPS TO REPRODUCE

Using Windows 10 with WSL Ubuntu 22.04
WSL has azure credential files located in /root/.azure folder, which is a symlink to the mount folder for the Windows filesystem
lrwxrwxrwx 1 root root 26 Jun 28 2023 .azure -> /mnt/c/Users/username/.azure

Trying to expose these same files inside of the EE when using ansible-navigator so it has the Azure credentials to retrieve Azure Key Vault secrets. Add a volume mount for /root/.azure as the source and destination so these files are in the expected location inside of the EE

EXPECTED RESULTS

Inside of the EE when ansible-navigator is ran, the folder /root/.azure will be mounted

ACTUAL RESULTS

/root/.azure is not present.
Reviewing debug logs shows that the symlink path is expanded for the source and destination. The source makes sense, but should not also be expanded as the destination path
Inside of the EE, the folder is mounted at /mnt/c/Users/username/.azure which does not address the reason it is being mounted
If the destination is set to a path that is not a symlink on the host system, it appears as expected, such as a destination of /root/.azure2 would mount as expected

ADDITIONAL INFORMATION

Doing the same volume mount with docker run directly works as expected with the folder being mounted where specified. This appears to be specific to ansible-navigator in my environment.

@MallocArray MallocArray added bug Researched, reproducible, committed to fix new New issues and PRs to triaged labels Oct 3, 2024
@shatakshiiii shatakshiiii removed the new New issues and PRs to triaged label Oct 23, 2024
@anxolerd
Copy link

I've encountered the same problem with different files, but essentially it is the same.

Made some digging and figured out that the issue lies here:

object.__setattr__(self, "fs_destination", expand_path(self.fs_destination))

When creating VolumeMount object, some preprocessing of the paths is done, like variables expansion and symlink resolution. I'm not sure whether this should be done for destination path at all.

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
Status: No status
Development

No branches or pull requests

3 participants