Reply
Accepted Solution

infoblox-client update

acas
Techie
Posts: 4
11338     0

Has anyone updated host records using python infoblox-client.  I can create and delete entries but I want to update.  I updated the object ipaddress under the HostRecordV4 but that did not update the rest of the ip4vaddrs section of the object.  The process I used was.

 

Get the host record.

Update object local.

 

Then tried to store the object back via the update method.  Is this right?

 

Any suggestion would be appreciated.

 

acas

Re: infoblox-client update

acas
Techie
Posts: 4
11339     0

I solved this I updated the ipv4addrs part of the object and it worked.  Updating the object HostRecordV4 does not affect the overall object change of IP.

Re: infoblox-client update

Authority
Posts: 42
11339     0

Sorry, but this isn't really helpful.

 

A snippet of code would be helpful.

 

For instance, I'm attempting to perform a lookup to see if a PTR record exists for an IP.  If one exists, I'l want to delete it, Trying to figure out the operands necesary for say objects.PtrRecord.fetch().

Re: infoblox-client update

Authority
Posts: 42
11339     0

so, using the infoblox-client, I can create an object in python:

from infoblox_client import connector
from infoblox_client import objects
opts = {'host' :ibgm, 'username' : u_name, 'password' : p_word}
conn = connector.Connector(opts)

#create
ea = objects.EA({'Date Assigned': str(datetime.date.today()), 'Source': 'HD Portal',
                 'User Contact': 'fitz@blotzmo.org'})
my_ip = objects.IP.create(ip='10.208.0.20')
host = objects.HostRecord.create(conn, name='new_host.blotzmo.org', ip=my_ip, extattrs=ea)

This gets me an object called host, of class infoblox_client.objects.HostRecordV4, which consists of:

HostRecordV4: ipv4addrs="[IPv4: ipv4addr="10.208.0.20", configure_for_dhcp="False", _ref="record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQub3JnLm1pdHJlLm5ld19ob3N0LjEwLjIwOC4wLjIwLg:10.208.0.20/new_host.blotzmo.org/Internal", ip="10.208.0.20", host="new_host.mitre.org"]", extattrs="EAs:Date Assigned=2019-04-26,Source=HD Portal,User Contact=fitz@blotzmo.org", _ref="record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm9yZy5taXRyZS5uZXdfaG9zdA:new_host.blotzmo.org/Internal", ipv4addr="10.208.0.20" I have a new EA, and I wish to update the object with this info.

At some time later in the same run, I need to add an EA, one which was unknown to me until AFTER I created the object.

 

If the new EA is:

ticket = '12345'
ea = objects.EA({'work#': ticket})

How do I update the object using the infoblox-client?  I will need to do this on a variety of Resource Record types, but expect the host record will be the most common.   I can do this using a different interface/client, but I'm trying to figure out this new one.

 

I suppose I could delete and then recreate, but that seems stupid, and the delete operation seems similar to the update operation, in that they are both documented as using self as the operand in the docs, with zero actual examples.

Showing results for 
Search instead for 
Do you mean 

Recommended for You