2012-09-24 19:17:26 +00:00
|
|
|
'''
|
2012-10-10 02:12:13 +00:00
|
|
|
CLI entry-point for salt-api
|
2012-09-24 19:17:26 +00:00
|
|
|
'''
|
|
|
|
# Import salt libs
|
2012-10-10 02:12:13 +00:00
|
|
|
from salt.utils.parsers import (
|
|
|
|
ConfigDirMixIn,
|
|
|
|
LogLevelMixIn,
|
|
|
|
OptionParser,
|
|
|
|
OptionParserMeta)
|
|
|
|
|
|
|
|
# Import salt-api libs
|
|
|
|
import saltapi.client
|
2012-09-24 19:17:26 +00:00
|
|
|
import saltapi.config
|
2012-10-10 02:12:13 +00:00
|
|
|
import saltapi.version
|
2012-09-24 19:17:26 +00:00
|
|
|
|
2012-10-10 02:12:13 +00:00
|
|
|
class SaltAPI(OptionParser, ConfigDirMixIn, LogLevelMixIn):
|
2012-09-24 19:17:26 +00:00
|
|
|
'''
|
|
|
|
The cli parser object used to fire up the salt api system.
|
|
|
|
'''
|
2012-10-10 02:12:13 +00:00
|
|
|
__metaclass__ = OptionParserMeta
|
2012-09-24 19:17:26 +00:00
|
|
|
|
2012-10-10 02:12:13 +00:00
|
|
|
VERSION = saltapi.version.__version__
|
2012-09-24 19:17:26 +00:00
|
|
|
|
2012-10-10 02:12:13 +00:00
|
|
|
def setup_config(self):
|
|
|
|
return saltapi.config.api_config(self.get_config_file_path('master'))
|
2012-09-24 19:17:26 +00:00
|
|
|
|
|
|
|
def run(self):
|
|
|
|
'''
|
|
|
|
Run the api
|
|
|
|
'''
|
2012-10-10 02:12:13 +00:00
|
|
|
self.parse_args()
|
|
|
|
self.process_config_dir()
|
|
|
|
client = saltapi.client.SaltAPIClient(self.config)
|
|
|
|
client.run()
|