mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #48752 from garethgreenaway/fix_state_file_all_integers
[2018.3] Fix when state file is integers
This commit is contained in:
commit
f2ef2d3ef6
@ -1301,6 +1301,10 @@ def sls(mods, test=None, exclude=None, queue=False, sync_mods=None, **kwargs):
|
||||
high_ = serial.load(fp_)
|
||||
return st_.state.call_high(high_, orchestration_jid)
|
||||
|
||||
# If the state file is an integer, convert to a string then to unicode
|
||||
if isinstance(mods, six.integer_types):
|
||||
mods = salt.utils.stringutils.to_unicode(str(mods)) # future lint: disable=blacklisted-function
|
||||
|
||||
if isinstance(mods, six.string_types):
|
||||
mods = mods.split(',')
|
||||
|
||||
|
2
tests/integration/files/file/base/12345.sls
Normal file
2
tests/integration/files/file/base/12345.sls
Normal file
@ -0,0 +1,2 @@
|
||||
always-passes:
|
||||
test.succeed_without_changes
|
@ -1957,3 +1957,19 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
state_file = os.path.join(TMP, 'testfile')
|
||||
if os.path.isfile(state_file):
|
||||
os.remove(state_file)
|
||||
|
||||
def test_state_sls_integer_name(self):
|
||||
'''
|
||||
This tests the case where the state file is named
|
||||
only with integers
|
||||
'''
|
||||
state_run = self.run_function(
|
||||
'state.sls',
|
||||
mods='12345'
|
||||
)
|
||||
|
||||
state_id = 'test_|-always-passes_|-always-passes_|-succeed_without_changes'
|
||||
self.assertIn(state_id, state_run)
|
||||
self.assertEqual(state_run[state_id]['comment'],
|
||||
'Success!')
|
||||
self.assertTrue(state_run[state_id]['result'])
|
||||
|
Loading…
Reference in New Issue
Block a user