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
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:
@@ -643,14 +643,14 @@ class DNSZoneManager:
|
|||||||
'type': desired['type'],
|
'type': desired['type'],
|
||||||
'values': desired['values']
|
'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}")
|
self.display.vvv(f"[{self.zone_name_str}] Removed: {name_str} {record_type}")
|
||||||
else:
|
else:
|
||||||
# State is 'present'
|
# State is 'present'
|
||||||
if key not in current_records:
|
if key not in current_records:
|
||||||
# Record doesn't exist - add it
|
# Record doesn't exist - add it
|
||||||
changes['adds'].append(desired)
|
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'])
|
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}")
|
self.display.vvv(f"[{self.zone_name_str}] Added: {name_str} {record_type} {values_str}")
|
||||||
else:
|
else:
|
||||||
@@ -658,7 +658,7 @@ class DNSZoneManager:
|
|||||||
current = current_records[key]
|
current = current_records[key]
|
||||||
if desired['values'] != current['values'] or desired['ttl'] != current['ttl']:
|
if desired['values'] != current['values'] or desired['ttl'] != current['ttl']:
|
||||||
changes['updates'].append(desired)
|
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'])
|
before_values = ', '.join(str(v) for v in current['values'])
|
||||||
after_values = ', '.join(str(v) for v in desired['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})")
|
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'],
|
'type': current['type'],
|
||||||
'values': current['values']
|
'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}")
|
self.display.vvv(f"[{self.zone_name_str}] Removed: {name_str} {record_type}")
|
||||||
|
|
||||||
return changes
|
return changes
|
||||||
|
|||||||
Reference in New Issue
Block a user