Reply

Trying to create a PTR record in PoSH or Python for an A record already existing

sparticus414
Techie
Posts: 1
3919     0

Hello,

 

I have a scenario where I have to register a few hundred computers at once, and someone had uploaded all of them in a CSV before the reverse zone existed.  Now that it does exist, I'm trying to programmatically create a PTR using either of the SDK's in the subject but they both produce the a very similar error.  Not sure what I'm doing incorrectly but it feels like I'm perhaps dealing with the wrong object. I haven't found any good examples of people creating forward and reverse records using the SDK's, and would appreciate any help you can provide.  for the powershell, I've tried the ipv4addras described by the schema too with the same results.

 

In powershell:

 New-IBObject -ObjectType recordSmiley Tonguetr  @{ptrdname='host.doman.net';ip_address='192.168.1.15'}

 

AdmConDataError: None (IBDataConflictError: IB.Data.Conflict:An invalid IP address or reverse zone was specified.)
At C:\Users\...Documents\WindowsPowerShell\Modules\Posh-IBWAPI\1.5.0\Public\Invoke-IBWAPI.ps1:141 char:13
+             throw [Exception] "$($wapiErr.Error)"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Smiley Happy [], Exception
    + FullyQualifiedErrorId : AdmConDataError: None (IBDataConflictError: IB.Data.Conflict:An invalid IP address or reverse zone was specified.)

 

 

 

In Python:

 

objects.PtrRecord.create(conn,ptrdname='host.domain.net',ip='192.168.1.15')

 

---------------------------------------------------------------------------
InfobloxCannotCreateObject                Traceback (most recent call last)
<ipython-input-95-8d2957d01856> in <module>
----> 1 objects.PtrRecord.create(conn,ip='192.168.1.15',ptrdname='host.domain.net')

~/.conda/envs/infoblox/lib/python3.6/site-packages/infoblox_client/objects.py in create(cls, connector, check_if_exists, update_if_exists, **kwargs)
    333                                     check_if_exists=check_if_exists,
    334                                     update_if_exists=update_if_exists,
--> 335                                     **kwargs))
    336         return ib_object
    337

~/.conda/envs/infoblox/lib/python3.6/site-packages/infoblox_client/objects.py in create_check_exists(cls, connector, check_if_exists, update_if_exists, **kwargs)
    313             reply = connector.create_object(local_obj.infoblox_type,
    314                                             local_obj.to_dict(),
--> 315                                             local_obj.return_fields)
    316             obj_created = True
    317             LOG.info("Infoblox %(obj_type)s was created: %(ib_obj)s",

~/.conda/envs/infoblox/lib/python3.6/site-packages/infoblox_client/connector.py in callee(*args, **kwargs)
     39     def callee(*args, **kwargs):
     40         try:
---> 41             return func(*args, **kwargs)
     42         except req_exc.Timeout as e:
     43             raise ib_ex.InfobloxTimeoutError(e)

~/.conda/envs/infoblox/lib/python3.6/site-packages/infoblox_client/connector.py in create_object(self, obj_type, payload, return_fields)
    362                 content=r.content,
    363                 args=payload,
--> 364                 code=r.status_code)
    365
    366         return self._parse_reply(r)

InfobloxCannotCreateObject: Cannot create 'recordSmiley Tonguetr' object(s): b'{ "Error": "AdmConDataError: None (IBDataConflictError: IB.Data.Conflict:An invalid IP address or reverse zone was specified.)", \n  "code": "Client.Ibap.Data.Conflict", \n  "text": "An invalid IP address or reverse zone was specified."\n}' [code 400]

 

 

 

 

Re: Trying to create a PTR record in PoSH or Python for an A record already existing

Adviser
Posts: 93
3920     0

Based on the error you are reporting, it seems that you do not have an appropriate DNS zone (e.g. 168.192.in-addr.arpa) required to hold the PTR recurd.

Showing results for 
Search instead for 
Do you mean 

Recommended for You