1"""
2    salt.cli.spm
3    ~~~~~~~~~~~~~
4
5    Salt's spm cli parser.
6
7.. versionadded:: 2015.8.0
8"""
9
10
11import salt.spm
12import salt.utils.parsers as parsers
13from salt.utils.verify import verify_env, verify_log
14
15
16class SPM(parsers.SPMParser):
17    """
18    The cli parser object used to fire up the salt spm system.
19    """
20
21    def run(self):
22        """
23        Run the api
24        """
25        ui = salt.spm.SPMCmdlineInterface()
26        self.parse_args()
27        self.setup_logfile_logger()
28        v_dirs = [
29            self.config["spm_cache_dir"],
30        ]
31        verify_env(
32            v_dirs,
33            self.config["user"],
34            root_dir=self.config["root_dir"],
35        )
36        verify_log(self.config)
37        client = salt.spm.SPMClient(ui, self.config)
38        client.run(self.args)
39