From 8076c9abb90bcde22be611b806e750fd19d1f249 Mon Sep 17 00:00:00 2001 From: Damian Myerscough Date: Wed, 2 Sep 2015 20:01:18 -0700 Subject: [PATCH] When using custom salt states we should allow the user to specify this on the command line. --- salt/cli/call.py | 5 +++++ salt/utils/parsers.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/salt/cli/call.py b/salt/cli/call.py index dba7a1a3de..dd902cb2fe 100644 --- a/salt/cli/call.py +++ b/salt/cli/call.py @@ -29,6 +29,11 @@ class SaltCall(parsers.SaltCallOptionParser): pillar_root = os.path.abspath(self.options.pillar_root) self.config['pillar_roots'] = {'base': _expand_glob_path([pillar_root])} + if self.options.states_dir: + # check if the argument is pointing to a file on disk + states_dir = os.path.abspath(self.options.states_dir) + self.config['states_dirs'] = [states_dir] + if self.options.local: self.config['file_client'] = 'local' if self.options.master: diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index 806c227e7a..1fe004dc6f 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -2246,6 +2246,11 @@ class SaltCallOptionParser(six.with_metaclass(OptionParserMeta, default=None, help='Set this directory as the base pillar root.' ) + self.add_option( + '--states-dir', + default=None, + help='Set this directory to search for additional states' + ) self.add_option( '--retcode-passthrough', default=False,