Skip to content

Commit

Permalink
lxd_container: simplify _needs_to_change_instance_config()
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanePrawn committed Jan 22, 2023
1 parent 91fea2c commit 70ff30f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions plugins/modules/lxd_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,16 +666,9 @@ def _needs_to_change_instance_config(self, key):
if key not in self.config:
return False

if key == 'config' and self.ignore_volatile_options: # the old behavior is to ignore configurations by keyword "volatile"
old_configs = dict((k, v) for k, v in self.old_sections.get(key, {}).items() if not k.startswith('volatile.'))
for k, v in self.config['config'].items():
if k not in old_configs:
return True
if old_configs[k] != v:
return True
return False
elif key == 'config': # next default behavior
old_configs = dict((k, v) for k, v in self.old_sections.get(key, {}).items())
if key == 'config':
# self.old_sections is already filtered for volatile keys if necessary
old_configs = dict(self.old_sections.get(key, {}).items())
for k, v in self.config['config'].items():
if k not in old_configs:
return True
Expand Down

0 comments on commit 70ff30f

Please sign in to comment.