MCPcopy
hub / github.com/saltstack/salt / execute

Method execute

salt/utils/find.py:580–596  ·  view source on GitHub ↗
(self, fullpath, fstat, test=False)

Source from the content-addressed store, hash-verified

578 self.command = value
579
580 def execute(self, fullpath, fstat, test=False):
581 try:
582 command = self.command.replace("{}", fullpath)
583 print(salt.utils.args.shlex_split(command))
584 p = Popen(salt.utils.args.shlex_split(command), stdout=PIPE, stderr=PIPE)
585 (out, err) = p.communicate()
586 if err:
587 log.error(
588 "Error running command: %s\n\n%s",
589 command,
590 salt.utils.stringutils.to_str(err),
591 )
592 return f"{command}:\n{salt.utils.stringutils.to_str(out)}\n"
593
594 except Exception as e: # pylint: disable=broad-except
595 log.error('Exception while executing command "%s":\n\n%s', command, e)
596 return f"{fullpath}: Failed"
597
598
599class Finder:

Callers 15

_report_coverageFunction · 0.45
run_queryFunction · 0.45
_flush_keyFunction · 0.45
_flush_bankFunction · 0.45
storeFunction · 0.45
initFunction · 0.45
infoFunction · 0.45
list_packagesFunction · 0.45
list_filesFunction · 0.45
register_pkgFunction · 0.45
register_fileFunction · 0.45
unregister_pkgFunction · 0.45

Calls 2

communicateMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected