Hello Masin,
using the interface of univention.admin
is very error prone. Instead use the univention.udm
package: https://docs.software-univention.de/ucs-python-api/univention.udm.html
>>> from univention.udm import UDM
>>> dns_forward_mod = UDM.admin().version(1).get("dns/forward_zone")
>>> for obj in dns_forward_mod.search():
... print(obj)
...
GenericObject('dns/forward_zone', 'zoneName=uni.dtr,cn=dns,dc=uni,dc=dtr')
>>> dns_host_mod = UDM.admin().version(1).get("dns/host_record")
>>> for obj in dns_host_mod.search("relativeDomainName=*7*"):
... print(obj)
...
GenericObject('dns/host_record', 'relativeDomainName=m70,zoneName=uni.dtr,cn=dns,dc=uni,dc=dtr')
GenericObject('dns/host_record', 'relativeDomainName=b71,zoneName=uni.dtr,cn=dns,dc=uni,dc=dtr')
Object values are what you see on the cmdline:
obj.dn: 'relativeDomainName=b71,zoneName=uni.dtr,cn=dns,dc=uni,dc=dtr'
obj.options: ['default']
obj.policies: []
obj.position: 'zoneName=uni.dtr,cn=dns,dc=uni,dc=dtr'
obj.props.a: ['10.200.3.71']
obj.props.mx: []
obj.props.name: 'b71'
obj.props.txt: []
obj.props.zonettl: None
obj.superordinate: 'zoneName=uni.dtr,cn=dns,dc=uni,dc=dtr'
After changing a property run obj.save()
to write the changes to LDAP.
Greetings
Daniel Tröder