Browse Source

fixed error detection for tsig key

tags/v2.0.0
Robin Thoni 6 years ago
parent
commit
9f3b9519f1
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      init.py

+ 2
- 1
init.py View File

52
     out = container.exec_run(['pdnsutil', 'set-meta', zone, 'TSIG-ALLOW-DNSUPDATE', key_name])
52
     out = container.exec_run(['pdnsutil', 'set-meta', zone, 'TSIG-ALLOW-DNSUPDATE', key_name])
53
     if out is not None:
53
     if out is not None:
54
         out = out.decode('UTF-8')
54
         out = out.decode('UTF-8')
55
-        return out == 'Enabled TSIG key %s for %s\n' % (key_name, zone) # might to strict, but as we can not get return code
55
+        return out == 'Set \'%s\' meta TSIG-ALLOW-DNSUPDATE = %s\n' % (zone, key_name) # might to strict, but as we can not get return code
56
     return False
56
     return False
57
 
57
 
58
 def main():
58
 def main():
127
             print('Adding TSIG %s to zone %s...' % (args.tsig_key_name, zone))
127
             print('Adding TSIG %s to zone %s...' % (args.tsig_key_name, zone))
128
             if not add_tsig_key_to_zone(container, zone, args.tsig_key_name):
128
             if not add_tsig_key_to_zone(container, zone, args.tsig_key_name):
129
                 print('Failed to add TSIG key to zone: Unknown error')
129
                 print('Failed to add TSIG key to zone: Unknown error')
130
+                return 8
130
 
131
 
131
     print('DHCP_TSIG_KEY_NAME=%s' % (args.tsig_key_name))
132
     print('DHCP_TSIG_KEY_NAME=%s' % (args.tsig_key_name))
132
     print('DHCP_TSIG_KEY_ALGO=%s' % (args.tsig_key_algo))
133
     print('DHCP_TSIG_KEY_ALGO=%s' % (args.tsig_key_algo))

Loading…
Cancel
Save