Skip to content

Commit

Permalink
Keep proxied state during IP-address update
Browse files Browse the repository at this point in the history
Previously the program didn't store the state of the
Cloudflare proxy setting, always setting it to proxied=False
during an update. With this commit the script will store
the state of the 'proxied' value and restore it during a record
update.
  • Loading branch information
xens committed Apr 17, 2019
1 parent 286cb0f commit a47bfcb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/example_update_dynamic_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ def do_dns_update(cf, zone_name, zone_id, dns_name, ip_address, ip_address_type)
updated = True
continue

proxied_state = dns_record['proxied']

# Yes, we need to update this record - we know it's the same address type

dns_record_id = dns_record['id']
dns_record = {
'name':dns_name,
'type':ip_address_type,
'content':ip_address
'content':ip_address,
'proxied':proxied_state
}
try:
dns_record = cf.zones.dns_records.put(zone_id, dns_record_id, data=dns_record)
Expand Down

0 comments on commit a47bfcb

Please sign in to comment.