Shouldn't run_command expand user on cwd ?

Hi,

I came across an issue today using the npm module where a path passed
via the 'path' parameter wasn't being user-expanded.

I tracked this down to the run_command function in
lib/ansible/module_utils/basic.py where the cwd param (originally 'path'
in npm) isn't user-expanded (e.g. ~foo -> /home/foo).

While the patch is trivial, I find it rather weird to stumble across
this, so I prefer to ask first. I guess that such an issue would have
come up already (unless all modules using paths do their own
user-expansion up front).

So, is it a module's responsabilty to call os.path.expanduser for paths,
or should run_module do it ?

Thanks for your clues,

M

The modules should do it.

Otherwise, generically, the module can’t know what is a path and what is not, and plus it must occur on the remote side anyway in some cases, but not always (as there are modules with local components)

More of an ansible-devel topic, FWIW, if you want to join that list.