mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
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:
parent
8ca526cc01
commit
c0455f8fa9
@ -49,6 +49,7 @@ SYS_TMP_DIR = tempfile.gettempdir()
|
|||||||
TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir')
|
TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir')
|
||||||
FILES = os.path.join(INTEGRATION_TEST_DIR, 'files')
|
FILES = os.path.join(INTEGRATION_TEST_DIR, 'files')
|
||||||
MOCKBIN = os.path.join(INTEGRATION_TEST_DIR, 'mockbin')
|
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,
|
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')]
|
'base': [os.path.join(FILES, 'pillar', 'base')]
|
||||||
}
|
}
|
||||||
self.master_opts['file_roots'] = {
|
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'] = [
|
self.master_opts['ext_pillar'] = [
|
||||||
{'cmd_yaml': 'cat {0}'.format(
|
{'cmd_yaml': 'cat {0}'.format(
|
||||||
@ -198,6 +204,7 @@ class TestDaemon(object):
|
|||||||
self.smaster_opts['sock_dir'],
|
self.smaster_opts['sock_dir'],
|
||||||
self.sub_minion_opts['sock_dir'],
|
self.sub_minion_opts['sock_dir'],
|
||||||
self.minion_opts['sock_dir'],
|
self.minion_opts['sock_dir'],
|
||||||
|
TMP_STATE_TREE,
|
||||||
TMP
|
TMP
|
||||||
],
|
],
|
||||||
pwd.getpwuid(os.getuid()).pw_name)
|
pwd.getpwuid(os.getuid()).pw_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user