Open ronan-lg opened 8 months ago
I think a much more future-proof, clean and safe (with respect to various kinds of injections when running commands on untrusted hosts) way is to use a proper serialization (JSON/XML) for transport. It is even much easier to handle the results on pyinfra
's side while simply switching from Get-ItemProperty -Path C:\Windows
to Get-ItemProperty -Path C:\Windows | ConvertTo-Json
and possibly requesting only a subset of fields for efficiency.
Is your feature request related to a problem? Please describe
As
Get-ItemProperty
output is different → parsing failsWindows PowerShell 5.1
PowerShell 7
In addition the output is colored:
Describe the solution you'd like
facts/windows_files.py
→class File(FactBase):
→process
methodfrom
to
facts/util/win_files.py
→WIN_LS_REGEX
definition, relax the filetype and mode patternfacts/util/win_files.py
→parse_win_ls_output
function, remove ansi sequencesto