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

"~username" in "file" not expanded #13

Closed
Lx opened this issue May 1, 2015 · 6 comments
Closed

"~username" in "file" not expanded #13

Lx opened this issue May 1, 2015 · 6 comments
Labels

Comments

@Lx
Copy link

Lx commented May 1, 2015

Given a call like this:

- xml: file=~user/data.xml ...

the following error occurs:

The target XML source does not exist: ~user/data.xml

even though built-in Ansible modules correctly expand ~user to the correct thing (which may not necessarily be /home/user).

@Lx
Copy link
Author

Lx commented May 2, 2015

I see that this issue is addressed by pending pull request #10.

@cmprescott
Copy link
Owner

I wouldn't hold your breath for them to merge in my PR. This project seems to be dead. If you need a workaround you can do something like {{ path | expanduser }}. More details on http://docs.ansible.com/playbooks_filters.html

@Lx
Copy link
Author

Lx commented May 3, 2015

Thanks for this workaround—much tidier than mine, which involved register-ing a shell call to echo ~user.

I hope development picks up again, because there doesn't seem to be another robust solution at this time for reading and writing XML from Ansible tasks.

@Lx
Copy link
Author

Lx commented May 4, 2015

Caveat for anyone else following: templates are rendered locally, so expanduser operates on data from the local machine, not the remote machine. To retrieve a home directory path for an arbitrary user on the remote machine, I'm back to doing this:

- name: note absolute home directory location for XML manipulation
  shell: echo ~user
  changed_when: false
  register: user_home_dir

@tbielawa
Copy link
Collaborator

tbielawa commented May 4, 2015

We're going to make an announcement about our livelihood very soon :-)
On May 3, 2015 1:37 AM, "Chris Prescott" notifications@github.com wrote:

I wouldn't hold your breath for them to merge in my PR. This project seems
to be dead. If you need a workaround you can do something like {{ path |
expanduser }}. More details on
http://docs.ansible.com/playbooks_filters.html


Reply to this email directly or view it on GitHub
https://github.com/RHInception/ansible-xml/issues/13#issuecomment-98439712
.

@tbielawa
Copy link
Collaborator

tbielawa commented May 4, 2015

Closed when #10 was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants