API ZoneEdit edit_zone_record TTL Update

BlackAqua

Registered
May 30, 2005
4
0
151
I have a home server with a dynamic IP. A subdomain points to this IP.

As it's dynamic, the following API2 (my first such attempt at doing this on cPanel) command is called via SSH as part of some wider (non-CP related) processing:

cpapi2 --user=$USER ZoneEdit edit_zone_record Line=$LINE domain=domain.com name=sub type=A address=$HOMEIP ttl=600 class=IN

The IP updates fine, however the TTL appears to be completely ignored and the server goes with the default (14400). The output from this on CLI is:

cpanelresult:
apiversion: 2
data:
-
result:
newserial: '2017010805'
status: 1
statusmsg: ''
event:
result: 1
func: edit_zone_record
module: ZoneEdit


Any ideas?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

I'm unable to reproduce this issue on a test system:

Code:
# grep sub123 /var/named/cptest01.com.db
sub123   600   IN   A   10.10.10.10
# cpapi2 --user=cptest01 ZoneEdit edit_zone_record Line=25 domain=cptest01.com name=sub123 type=A address=10.10.10.10 ttl=700 class=IN
# grep sub123 /var/named/cptest01.com.db
sub123   700   IN   A   10.10.10.10
Could you verify which version of cPanel is installed on this system? Also, are you manually entering a IP Address in place of "$HOMEIP" in the example you provided, or is the value obtained from a custom script?

Thank you.
 

BlackAqua

Registered
May 30, 2005
4
0
151
Hi Michael,

The IP is obtained via a custom script, but as mentioned, the IP is updated OK.

So I've manually set the TTL to 600 in WHM web...

Code:
# grep sub /var/named/domain.com.db
sub     600     IN      A       255.255.255.255
# cpapi2 --user=username ZoneEdit edit_zone_record Line=48 domain=domain.com name=sub type=A address=10.10.10.10 ttl=600 class=IN
---
cpanelresult:
  apiversion: 2
  data:
    -
      result:
        newserial: '2017011504'
        status: 1
        statusmsg: ''
  event:
    result: 1
  func: edit_zone_record
  module: ZoneEdit
# grep sub/var/named/domain.com.db
sub     14400   IN      A       10.10.10.10
Note how it reverts back to 14400.

Code:
/etc/redhat-release:CentOS Linux release 7.3.1611 (Core)
/usr/local/cpanel/version:11.62.0.2
/var/cpanel/envtype:virtuozzo
CPANEL=current
Server version: Apache/2.4.25 (cPanel)
Server built:   Jan  4 2017 14:51:03
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

I've tested with PowerDNS and am still unable to reproduce the issue. Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

Thank you.