Created
October 11, 2018 15:23
-
-
Save pcn/cf69a85fbb7bcea0f6f61c47e929c6b3 to your computer and use it in GitHub Desktop.
This seems to allow for running a salt client, ala salt-call, from within a python script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import salt.cli.call | |
call = salt.cli.call.SaltCall() | |
call.parse_args(args=['state.highstate']) | |
# It's initialized but it's going to try to parse the command line, | |
# so override those properties | |
if call.options.master: | |
call.config['master'] = call.options.master | |
# Setup file logging! | |
call.setup_logfile_logger() | |
verify_log(call.config) | |
caller = salt.cli.caller.Caller.factory(call.config) | |
caller.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment