fix: apply_cell_name regex now matches zone files with TTL field
_generate_zone_content writes records as "name TTL IN A value" but the regex only matched "name IN A value" (no TTL), so renaming the cell never updated the DNS hostname record. Updated regex to make TTL optional. Also fixed the unit test zone fixture to use the actual generated format. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -520,8 +520,9 @@ class NetworkManager(BaseServiceManager):
|
||||
zone_file = os.path.join(dns_data, fname)
|
||||
with open(zone_file) as f:
|
||||
content = f.read()
|
||||
# Match name with optional TTL: "name [ttl] IN A value"
|
||||
content = re.sub(
|
||||
rf'^{re.escape(old_name)}(\s+IN\s+A\s+)',
|
||||
rf'^{re.escape(old_name)}(\s+(?:\d+\s+)?IN\s+A\s+)',
|
||||
f'{new_name}\\1',
|
||||
content, flags=re.MULTILINE
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user