Closed taliaferro closed 2 months ago
Hi @taliaferro - you've stumbled across a long standing bug here!
The group_data
flag is designed to specify a directory, but the actual check also joins group_data
, so if you say --group-data tmp
the file must be tmp/group_data/all.py
- this is clearly very broken.
Additionally there's an issue loading global arguments from group data (filtering out keys starting _
). I suspect this has gone unnoticed due to the expanded use of inventory functions as an alternative to group data.
So there's a few issues:
--group-data
should allow an explicit file or directory--group-data
items should NOT get group_data
path added to them_
prefix, ie all global argumentsFixed in https://github.com/pyinfra-dev/pyinfra/commit/139d8b6c794554e5f7c4ba6d93852fbf253aa0d6 and https://github.com/pyinfra-dev/pyinfra/commit/a03c2cef281c6b0f3f7df95ee89a554f4a31dd6c. Will be releasing 3.0.1 with these today.
Describe the bug
The documentation about inventory data reads:
However, setting those variables in, for example,
group_data/all.py
, does not enable sudo by default for all operations.To Reproduce
Here's an example using the
@docker
connector. The operation will succeed because the container already runs as root, but I've set it to maximum verbosity to see the actual commands getting run -- notice that those commands do not includesudo
.output:
Expected behavior
When I add the line
_sudo=True
togroup_data/all.py
, I expect operations to be run with sudo by default.Meta