Proper minion config setup

This commit is contained in:
Pedro Algarvio 2014-12-02 07:34:45 +00:00
parent 83153354c4
commit 0dd818053e

View File

@ -12,18 +12,28 @@ import salt.config
from salt.state import HighState
OPTS = salt.config.minion_config(None)
OPTS['id'] = 'match'
OPTS['file_client'] = 'local'
OPTS['file_roots'] = dict(base=['/tmp'])
OPTS['test'] = False
OPTS['grains'] = salt.loader.grains(OPTS)
OPTS['cachedir'] = 'cachedir'
class HighStateTestCase(TestCase):
def setUp(self):
self.highstate = HighState(OPTS)
self.root_dir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP)
self.state_tree_dir = os.path.join(self.root_dir, 'state_tree')
self.cache_dir = os.path.join(self.root_dir, 'cachedir')
if not os.path.isdir(self.root_dir):
os.makedirs(self.root_dir)
if not os.path.isdir(self.state_tree_dir):
os.makedirs(self.state_tree_dir)
if not os.path.isdir(self.cache_dir):
os.makedirs(self.cache_dir)
self.config = salt.config.minion_config(None)
self.config['root_dir'] = self.root_dir
self.config['state_events'] = False
self.config['id'] = 'match'
self.config['file_client'] = 'local'
self.config['file_roots'] = dict(base=[self.state_tree_dir])
self.config['cachedir'] = self.cache_dir
self.config['test'] = False
self.highstate = HighState(self.config)
self.highstate.push_active()
def tearDown(self):