无法通过 infoblox-client 修改 infoblox 中的主机记录名称

Not able to modify the host record name in infoblox via infoblox-client

我正在尝试更新 'host record name',为了实现同样的目的,我正在使用 infoblox-client,但我遇到了障碍,因为我无法 modify/update 主机记录。我已经通过 REST API 进行了相同的尝试,并且能够根据需要修改名称,但是通过 infoblox-client m 有点卡住了。

以下是我尝试更新记录的步骤:

opts = {'host': '192.168.1.10', 'username': 'admin', 'password': 'admin'}

conn = connector.Connector(opts)
my_ip = objects.IP.create(ip='192.168.1.25')
#to create new host record with parameters
record = objects.HostRecord.create(conn, view='my_dns_view', name='my_host_record.my_zone.com', ip=my_ip)

#to modify m trying following but no luck:

#1_both of below snippet adds a new name to record instead of upodating the same
-> result = objects.HostRecord.create(conn, view='my_dns_view', name='new_name.my_zone.com', ip=my_ip, check_if_exists=True, update_if_exists=True)

-> result = objects.ARecordBase.create(conn, ip='192.168.102.14', name='some-new_name.ansible.com', view='default', update_if_exists=True)

#2_I have gone through infoblox-client test case(test_update_fields_on_create) which I have following steps to modify record:
 a_record = [{'_ref': 'record:previously_created_record', 'ip': '192.168.1.52', 'name': 'other_name'}]

#this gives me error for host,username missing.
conn = connector.Connector(a_record)

#this results to None which ultimately blocks me
res = conn.get_object('record:host',a_record) 

我能够解决这个问题,但混淆了创建和更新。

因此,对于遇到类似问题的任何人,这里是编码解决方案:

    opts = {'host': '192.168.1.10', 'username': 'admin', 'password': 'admin'}
    conn = connector.Connector(opts)
    my_ip = objects.IP.create(ip='192.168.1.25')
    #to create new host record with parameters
    record = objects.HostRecord.create(conn, view='my_dns_view', name='host_record.my_zone.com', ip=my_ip)

    #to update the name, directly use update_object:
    testConn = conn.update_object(record._ref, {'name': 'new_name_host_record.my_zone.com'})

简单..我之前拐弯抹角..