Open karolzlot opened 3 years ago
Hi @karolzlot! I believe this is due to the @docker
trying to execute the local docker
command insdie a unix sh
shell. I've not got Windows access currently but need to double check this - I think that both @docker
and @local
connectors will be broken due to this.
However - it's possible to override this value via the --shell-executable
CLI flag. I've not tested but one of these may work:
pyinfra --shell-executable ps @docker/ubuntu:18.04 exec -- echo "hello world"
pyinfra --shell-executable pws @docker/ubuntu:18.04 exec -- echo "hello world"
I'll be able to test this properly on my Windows laptop over the next few days.
Because this issue related let me put some research on issue and in general how to make @local
works on windows:
some facts (Home, Where, Date) force shell-executable=cmd
so cli option has no effect and dont work at all because @local
use cmd -c
and its wrong syntax
escaping problems...pyinfra send command in single quotes so powershell -c
interprets it as string and not command to execute i.e. I've try to rewrite facts that use cmd and cannot execute command because of this
--> Gathering facts...
[pyinfra\api\facts] Getting fact: windows.Home () (ensure_hosts: None)
[pyinfra\connectors\local] --> Running command on localhost: pwsh -NoLogo -NoProfile -c 'Write-Host $env:HOMEPATH'
[@local] >>> pwsh -NoLogo -NoProfile -c 'Write-Host $env:HOMEPATH'
[@local] Write-Host $env:HOMEPATH
[pyinfra\connectors\util] --> Waiting for exit status...
[pyinfra\connectors\util] --> Command exit status: 0
[@local] Loaded fact windows.Home
--> Fact data for: windows.Home { "@local": "Write-Host $env:HOMEPATH\r" }
3. problems with parsing cli commands in powershell (could be my personal issue or related to 2) i.e.
$>pyinfra.exe @local --shell-executable=pwsh exec -- ls
Invalid operations: ('ls',)
```
same command in `cmd` works as expected
Moving this to pyinfra-windows for potential support via a new connector specific for Windows @windowslocal
or something..
Describe the bug
I got error as in log below. I repeated command, but the error persist.
To Reproduce
pyinfra @docker/ubuntu:18.04 exec -- echo "hello world"
Expected behavior
No error
Meta
pyinfra --support
:pip in venv
not created
-vv
and--debug
.