mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Fix lxc cloud provided minion reporting present
LXC minion is reporting as present when configured with cloud state, even though it is not. Fixes issue #31000
This commit is contained in:
parent
64125de6c7
commit
9b17fdce5e
@ -260,8 +260,7 @@ def profile(name, profile, onlyif=None, unless=None, **kwargs):
|
||||
if retcode(unless, python_shell=True) == 0:
|
||||
return _valid(name, comment='unless execution succeeded')
|
||||
instance = _get_instance([name])
|
||||
prov = str(next(six.iterkeys(instance)))
|
||||
if instance and 'Not Actioned' not in prov:
|
||||
if instance and not any('Not Actioned' in key for key in instance):
|
||||
ret['result'] = True
|
||||
ret['comment'] = 'Already present instance {0}'.format(name)
|
||||
return ret
|
||||
|
@ -146,7 +146,11 @@ class CloudTestCase(TestCase):
|
||||
mock = MagicMock(side_effect=[True, False])
|
||||
mock_dict = MagicMock(side_effect=[{'cloud': 'saltcloud'},
|
||||
{'Not Actioned': True},
|
||||
{'Not Actioned': True}])
|
||||
{'Not Actioned': True},
|
||||
{
|
||||
'Not Found': True,
|
||||
'Not Actioned/Not Running': True
|
||||
}])
|
||||
mock_d = MagicMock(return_value={})
|
||||
with patch.dict(cloud.__salt__, {'cmd.retcode': mock,
|
||||
'cloud.profile': mock_d,
|
||||
@ -179,6 +183,12 @@ class CloudTestCase(TestCase):
|
||||
ret.update({'comment': comt, 'result': False})
|
||||
self.assertDictEqual(cloud.profile(name, profile), ret)
|
||||
|
||||
with patch.dict(cloud.__opts__, {'test': False}):
|
||||
comt = (('Failed to create instance {0}'
|
||||
'using profile {1}').format(name, profile))
|
||||
ret.update({'comment': comt, 'result': False})
|
||||
self.assertDictEqual(cloud.profile(name, profile), ret)
|
||||
|
||||
# 'volume_present' function tests: 1
|
||||
|
||||
def test_volume_present(self):
|
||||
|
Loading…
Reference in New Issue
Block a user