feat: show detailed changes with --diff flag
Some checks failed
Test Collection / Sanity Tests (Ansible devel) (push) Failing after 12s
Test Collection / Sanity Tests (Ansible stable-2.15) (push) Failing after 30s
Test Collection / Sanity Tests (Ansible stable-2.16) (push) Failing after 30s
Test Collection / Sanity Tests (Ansible stable-2.17) (push) Failing after 28s
Test Collection / Python Syntax Check (push) Successful in 6s
Test Collection / YAML and Ansible Lint (push) Successful in 11s
Test Collection / Build Collection (push) Failing after 8s
Test Collection / Documentation Check (push) Successful in 7s
Test Collection / Unit Tests (push) Successful in 6s

- Display specific record changes when --diff flag is used
- Add 'or self.module._diff' condition to all change logging
- Shows Added, Removed, Changed records with --diff (same as -v)
- Skipped records still only shown with -vv
- Provides detailed diff output without requiring -v flag
- Users can now see what changed with just --diff flag
This commit is contained in:
Daniel Akulenok
2026-01-29 20:55:26 +01:00
parent b1f2d9f3a1
commit 4843c71606

View File

@@ -643,14 +643,14 @@ class DNSZoneManager:
'type': desired['type'],
'values': desired['values']
})
if self.module._verbosity >= 1:
if self.module._verbosity >= 1 or self.module._diff:
self.display.vvv(f"[{self.zone_name_str}] Removed: {name_str} {record_type}")
else:
# State is 'present'
if key not in current_records:
# Record doesn't exist - add it
changes['adds'].append(desired)
if self.module._verbosity >= 1:
if self.module._verbosity >= 1 or self.module._diff:
values_str = ', '.join(str(v) for v in desired['values'])
self.display.vvv(f"[{self.zone_name_str}] Added: {name_str} {record_type} {values_str}")
else:
@@ -658,7 +658,7 @@ class DNSZoneManager:
current = current_records[key]
if desired['values'] != current['values'] or desired['ttl'] != current['ttl']:
changes['updates'].append(desired)
if self.module._verbosity >= 1:
if self.module._verbosity >= 1 or self.module._diff:
before_values = ', '.join(str(v) for v in current['values'])
after_values = ', '.join(str(v) for v in desired['values'])
self.display.vvv(f"[{self.zone_name_str}] Changed: {name_str} {record_type} ({before_values} -> {after_values})")
@@ -679,7 +679,7 @@ class DNSZoneManager:
'type': current['type'],
'values': current['values']
})
if self.module._verbosity >= 1:
if self.module._verbosity >= 1 or self.module._diff:
self.display.vvv(f"[{self.zone_name_str}] Removed: {name_str} {record_type}")
return changes