#!/usr/bin/env python
"""This is a class and a script to api to PowerDnsAdmin."""

# pylint: disable=E0401
from admin_api.clientapi import Clientapi
import sys


CLIAPI = Clientapi()
print('######## performing add')
# pylint: disable=C0103
#1 but wrong vcs52u002.sin01.pop 12.96.168.192.in-addr.arpa vcs44u002.sin01.pop
dictof = {
    '192.168.184.1': 'vmware-lod-gw.pf.vips.den01.pop',
    '192.168.192.1': 'vmware-lod-vips-old-gw.pf.vips.den01.pop',
    '192.168.195.1': 'vmware-lod-vips-oldest-gw.pf.vips.den01.pop',
    '192.168.196.1': 'vmware-lod-vips-gw.pf.vips.den01.pop'}


for ipaddress in dictof:
    hostname = dictof[ipaddress]
    ipspl = ipaddress.split('.')
    revname = '%s.%s.%s.%s.in-addr.arpa' % (ipspl[3], ipspl[2], ipspl[1], ipspl[0])

    print "Attempting chage revname %s to be a PTR record pointing to %s " % (revname, hostname)
    CLIAPI.fixrev(hostname=hostname, revname=revname)
    #sys.exit()
