Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create DNSZoneForward fails #374

Open
pmusolino-rms opened this issue Oct 17, 2023 · 1 comment
Open

create DNSZoneForward fails #374

pmusolino-rms opened this issue Oct 17, 2023 · 1 comment

Comments

@pmusolino-rms
Copy link

pmusolino-rms commented Oct 17, 2023

wapi 2.10
infoblox_client version 0.6

Traceback (most recent call last):
  File "/BLOX/create_forward_zones.py", line 66, in <module>
    main()
  File "/BLOX/create_forward_zones.py", line 63, in main
    create_forward_zone(connection, domain="thisisatest.com", fwd_group="Forwarding DNS", ext_servers=my_dict)
  File "/IBLOX/create_forward_zones.py", line 39, in create_forward_zone
    fwd_zone = objects.DNSZoneForward.create(conn,fqdn=domain, forward_to=ext_server_list,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/IBLOX/venv/lib/python3.11/site-packages/infoblox_client/objects.py", line 370, in create
    cls.create_check_exists(connector,
  File "/IBLOX/venv/lib/python3.11/site-packages/infoblox_client/objects.py", line 326, in create_check_exists
    reply = connector.create_object(local_obj.infoblox_type,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/IBLOX/venv/lib/python3.11/site-packages/infoblox_client/connector.py", line 53, in callee
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/IBLOX/venv/lib/python3.11/site-packages/infoblox_client/connector.py", line 450, in create_object
    raise exception(
infoblox_client.exceptions.InfobloxCannotCreateObject: Cannot create 'zone_forward' object(s): b'{ "Error": "AdmConDataError: A domain label either starts or ends with an invalid character.", \n  "code": "Client.Ibap.Data", \n  "text": "A domain label either starts or ends with an invalid character."\n}' [code 400]

code block

def create_forward_zone(conn, domain: str, fwd_group: str, ext_servers: dict) -> None:
    """Create a forward zone using a domain string, forwarder group name, and 
    external server dictionary"""
    ext_server_list = []
    for name, ipv4addr in ext_servers.items():
        ext_server = objects.Extserver(name=name,address=ipv4addr)
        ext_server_list.append(ext_server)
    try:
        #create forward zone
        fwd_zone = objects.DNSZoneForward.create(conn,fqdn=domain, forward_to=ext_server_list,
                                                 ns_group=fwd_group,
                                                 fowarders_only = True,)
        print(f"{domain} created")
    except exceptions.InfobloxFetchGotMultipleObjects:
        print("Already exists")
    return
@pmusolino-rms
Copy link
Author

One of the name servers in the external server list had a trailing period. Removing this fixed it. If it is in scope, can a check be created on the ExtServer structure to see if a valid string is being passed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant