You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When supplying vm_overrides to the cloud.profile runner, any top-level keys in vm_overrides cause the associated definitions in the profile to be completely overwritten (i.e. replaced, whereas the expectation was that they would be merged)
Steps to Reproduce Issue
Given the following profile definition :
my-vm-profile:
# [...]
devices:
disk:
Hard disk 1:
size: 5
thin_provision: False
Hard disk 2:
size: 128
thin_provision: True
network:
Network adapter 1:
name: VM Network
switch_type: standard
adapter_type: vmxnet3
calling the following (intending for the above profile definitions to take effect while specifying an IP address):
causes the entiredevices entry to be replaced with what is specified on the command line (i.e. disk definitions are gone).
This is caused by dict.update being used to apply the overrides definition in salt.cloud.vm_config() (whereas salt.utils.dictupdate.update() would merge them, e.g.:
diff --git a/salt/cloud/__init__.py b/salt/cloud/__init__.py
index 2b21483599..35292003f7 100644
--- a/salt/cloud/__init__.py
+++ b/salt/cloud/__init__.py
@@ -1313,7 +1313,7 @@ class Cloud:
vm = main.copy()
vm = salt.utils.dictupdate.update(vm, provider)
vm = salt.utils.dictupdate.update(vm, profile)
- vm.update(overrides)
+ vm = salt.utils.dictupdate.update(vm, overrides)
vm["name"] = name
return vm
Versions Report
This was observed on 3002.9, but code inspection shows this is still the case in 3005
The text was updated successfully, but these errors were encountered:
a-wildman
changed the title
Specifying vm_overrides with cloud.profile runner does not merge configuration from the profile
[BUG] Specifying vm_overrides with cloud.profile runner does not merge configuration from the profile
Dec 21, 2022
Description of Issue
When supplying
vm_overrides
to thecloud.profile
runner, any top-level keys invm_overrides
cause the associated definitions in theprofile
to be completely overwritten (i.e. replaced, whereas the expectation was that they would be merged)Steps to Reproduce Issue
Given the following profile definition :
calling the following (intending for the above profile definitions to take effect while specifying an IP address):
salt-run cloud.profile profile=my-vm-profile names=new-vm.example.com vm_overrides="{'devices' : {'network' : {'Network adapter 1' : {'ip' : '192.168.0.10'} } } }"
causes the entire
devices
entry to be replaced with what is specified on the command line (i.e.disk
definitions are gone).This is caused by
dict.update
being used to apply the overrides definition insalt.cloud.vm_config()
(whereassalt.utils.dictupdate.update()
would merge them, e.g.:Versions Report
This was observed on 3002.9, but code inspection shows this is still the case in 3005
The text was updated successfully, but these errors were encountered: