Compare commits

...

4 Commits

Author SHA1 Message Date
nemunaire bd820e4c53 Prepare 0.4.0
continuous-integration/drone/tag Build is passing Details
2023-12-10 12:41:07 +01:00
nemunaire 734e89e720 Refactor condition for changed result 2023-12-10 12:40:04 +01:00
nemunaire 360bc2a587 Fix get_zone args 2023-12-10 12:39:42 +01:00
nemunaire 106e879eb9 If no zone is given, use the most recent one 2023-12-10 12:39:15 +01:00
2 changed files with 14 additions and 13 deletions

View File

@ -1,7 +1,7 @@
---
namespace: happydns
name: happydomain
version: 0.3.3
version: 0.4.0
readme: README.md
authors:
- happyDomain Team <happydomain.org>

View File

@ -54,9 +54,10 @@ def main():
for d in domains:
if d.domain == p['domain'] or d.domain == p['domain'] + ".":
for z in d.zone_history:
if z == p['zone']:
zone = d.get_zone(z)
if p['zone'] is None or z == p['zone']:
zone = d.get_zone(z.id)
skipAdd = False
if p['subdomain'].removesuffix(d.domain) in zone.services:
for s in zone.services[p['subdomain'].removesuffix(d.domain)]:
if s._svctype == p['type']:
@ -67,19 +68,20 @@ def main():
differ = True
break
if p['erase_others']:
if p['state'] == 'absent' and not differ:
s.delete()
result['changed'] = True
elif p['erase_others']:
if differ:
s.delete()
result['changed'] = True
elif not differ:
if p['state'] == 'absent':
s.delete()
result['changed'] = True
else:
module.exit_json(**result)
return
skipAdd = True
elif not differ:
module.exit_json(**result)
return
if p['state'] != 'absent':
if not skipAdd and p['state'] != 'absent':
zone.add_zone_service(
p['subdomain'].removesuffix(d.domain),
p['type'],
@ -88,10 +90,9 @@ def main():
result['changed'] = True
if p['apply_changes']:
if p['apply_changes'] and result['changed']:
zone.apply_changes()
result['published'] = True
result['changed'] = True
break
else: