MCPcopy Create free account
hub / github.com/saltstack/salt / _prep_powershell_json

Function _prep_powershell_json

salt/modules/cmdmod.py:4808–4821  ·  view source on GitHub ↗

Try to fix the output from OutputTo-JSON in powershell commands to make it valid JSON

(text)

Source from the content-addressed store, hash-verified

4806
4807
4808def _prep_powershell_json(text):
4809 """
4810 Try to fix the output from OutputTo-JSON in powershell commands to make it
4811 valid JSON
4812 """
4813 # An empty string just needs to be an empty quote
4814 if text == "":
4815 text = '""'
4816 else:
4817 # Raw text needs to be quoted
4818 starts_with = ['"', "{", "["]
4819 if not any(text.startswith(x) for x in starts_with):
4820 text = f'"{text}"'
4821 return text
4822
4823
4824def run_bg(

Callers 2

powershellFunction · 0.85
powershell_allFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected