salt/saltapi/cli.py

35 lines
806 B
Python
Raw Normal View History

2012-09-24 19:17:26 +00:00
'''
CLI entry-point for salt-api
2012-09-24 19:17:26 +00:00
'''
# Import salt libs
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
import saltapi.version
2012-09-24 19:17:26 +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.
'''
__metaclass__ = OptionParserMeta
2012-09-24 19:17:26 +00:00
VERSION = saltapi.version.__version__
2012-09-24 19:17:26 +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
'''
self.parse_args()
self.process_config_dir()
client = saltapi.client.SaltAPIClient(self.config)
client.run()