Support creating state files at runtime.

We now support runtime created files that can be used like `salt://my-temp-file.txt`.
Just make sure you write them to `os.path.join(integration.TMP_STATE_TREE, 'my-temp-file.txt')`.
This commit is contained in:
Pedro Algarvio 2012-12-12 18:38:39 +00:00
parent 8ca526cc01
commit c0455f8fa9

View File

@ -49,6 +49,7 @@ SYS_TMP_DIR = tempfile.gettempdir()
TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir')
FILES = os.path.join(INTEGRATION_TEST_DIR, 'files')
MOCKBIN = os.path.join(INTEGRATION_TEST_DIR, 'mockbin')
TMP_STATE_TREE = os.path.join(SYS_TMP_DIR, 'salt-temp-state-tree')
def print_header(header, sep='~', top=True, bottom=True, inline=False,
@ -159,7 +160,12 @@ class TestDaemon(object):
'base': [os.path.join(FILES, 'pillar', 'base')]
}
self.master_opts['file_roots'] = {
'base': [os.path.join(FILES, 'file', 'base')]
'base': [
os.path.join(FILES, 'file', 'base'),
# Let's support runtime created files that can be used like:
# salt://my-temp-file.txt
TMP_STATE_TREE
]
}
self.master_opts['ext_pillar'] = [
{'cmd_yaml': 'cat {0}'.format(
@ -198,6 +204,7 @@ class TestDaemon(object):
self.smaster_opts['sock_dir'],
self.sub_minion_opts['sock_dir'],
self.minion_opts['sock_dir'],
TMP_STATE_TREE,
TMP
],
pwd.getpwuid(os.getuid()).pw_name)