mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Remove profile from opts after creating LXC container
When using cloud states to manage LXC containers __opts__['profile'] is not implicitly reset between operations on different containers. However list_nodes will hide container if profile is set in opts assuming that it have to be created. But in cloud state we do want to check at first if it really exists hence the need to remove profile from global opts once current container is created. Before this change salt would try to bootstrap other LXC containers configured with help of LXC cloud state after legitimately creating new container, even if those other containers were already up and running. Probably the better solution would be to change filtering algorithm in list_nodes but I'm not confident enough to do that.
This commit is contained in:
parent
c4047d2a71
commit
64250a67e5
1 changed files with 11 additions and 0 deletions
|
@ -428,6 +428,17 @@ def create(vm_, call=None):
|
|||
ret['Error'] = 'Error while creating {0},'.format(vm_['name'])
|
||||
else:
|
||||
ret['changes']['created'] = 'created'
|
||||
|
||||
# When using cloud states to manage LXC containers
|
||||
# __opts__['profile'] is not implicitly reset between operations
|
||||
# on different containers. However list_nodes will hide container
|
||||
# if profile is set in opts assuming that it have to be created.
|
||||
# But in cloud state we do want to check at first if it really
|
||||
# exists hence the need to remove profile from global opts once
|
||||
# current container is created.
|
||||
if 'profile' in __opts__:
|
||||
del __opts__['profile']
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue