I'm writing a custom Salt Stack runner to wrap accepting and rejecting minions. How do I call salt-key from my python runner that's equivalent to this from command line
salt-key -a {minion_name}
I can't provide you a definite answer, but here are my two cents:
The source code of the salt-key script is this one. Following the call chain, I reached this module which contains several classes to do key processing.
The module's documentation reads:
The Salt Key backend API and interface used by the CLI. The Key class can be used to manage salt keys directly without interfacing with the CLI.
This is the mentioned class.
Based on this code, I presume it's used like:
import salt.client
import salt.key
client = salt.client.LocalClient()
key_manager = salt.key.Key(client.opts)
key_manager.accept('web*')