ansible-config avoid _terms and _input in --only-changed (#76597)

dont display _terms or _intput on only changed
 those always change and it expected for the plugins that support them


Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/76765/head
Brian Coca 3 years ago committed by GitHub
parent 0ff80a15ba
commit 2246ed9678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ansible-config avoid showing _terms and _input when --only-changed.

@ -370,18 +370,23 @@ class ConfigCLI(CLI):
text = []
for setting in sorted(config):
changed = False
if isinstance(config[setting], Setting):
# proceed normally
if config[setting].origin == 'default':
color = 'green'
elif config[setting].origin == 'REQUIRED':
# should include '_terms', '_input', etc
color = 'red'
else:
color = 'yellow'
changed = True
msg = "%s(%s) = %s" % (setting, config[setting].origin, config[setting].value)
else:
color = 'green'
msg = "%s(%s) = %s" % (setting, 'default', config[setting].get('default'))
if not context.CLIARGS['only_changed'] or color == 'yellow':
if not context.CLIARGS['only_changed'] or changed:
text.append(stringc(msg, color))
return text
@ -445,6 +450,11 @@ class ConfigCLI(CLI):
o = 'REQUIRED'
else:
raise e
if v is None and o is None:
# not all cases will be error
o = 'REQUIRED'
config_entries[finalname][setting] = Setting(setting, v, o, None)
# pretty please!

Loading…
Cancel
Save