can't update dns resource using cli

Bug #1804563 reported by Jack Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Medium
Newell Jensen
2.6
Fix Released
Medium
Newell Jensen

Bug Description

Created 'com' domain and added one dnsresources:

```
$ maas st dnsresources read domain=com
Success.
Machine-readable output follows:
[
    {
        "address_ttl": null,
        "id": 98,
        "ip_addresses": [
            {
                "created": "2018-11-02T10:00:57.200",
                "ip": "10.10.26.163",
                "alloc_type": 1,
                "subnet": {
                    "name": "10.10.26.0/24",
                    "vlan": {
                        "vid": 0,
                        "mtu": 1500,
                        "dhcp_on": true,
                        "external_dhcp": null,
                        "relay_vlan": null,
                        "primary_rack": "rekyhd",
                        "id": 5001,
                        "name": "untagged",
                        "fabric_id": 0,
                        "secondary_rack": null,
                        "space": "undefined",
                        "fabric": "fabric-0",
                        "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                    },
                    "cidr": "10.10.26.0/24",
                    "rdns_mode": 2,
                    "gateway_ip": "10.10.26.0",
                    "dns_servers": [],
                    "allow_proxy": true,
                    "active_discovery": false,
                    "managed": true,
                    "id": 1,
                    "space": "undefined",
                    "resource_uri": "/MAAS/api/2.0/subnets/1/"
                },
                "owner": null,
                "alloc_type_name": "Static",
                "interface_set": [
                    {
                        "mac_address": "a4:bf:01:51:52:87",
                        "links": [
                            {
                                "id": 1,
                                "mode": "static",
                                "ip_address": "10.10.26.163",
                                "subnet": {
                                    "name": "10.10.26.0/24",
                                    "vlan": {
                                        "vid": 0,
                                        "mtu": 1500,
                                        "dhcp_on": true,
                                        "external_dhcp": null,
                                        "relay_vlan": null,
                                        "primary_rack": "rekyhd",
                                        "id": 5001,
                                        "name": "untagged",
                                        "fabric_id": 0,
                                        "secondary_rack": null,
                                        "space": "undefined",
                                        "fabric": "fabric-0",
                                        "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                                    },
                                    "cidr": "10.10.26.0/24",
                                    "rdns_mode": 2,
                                    "gateway_ip": "10.10.26.0",
                                    "dns_servers": [],
                                    "allow_proxy": true,
                                    "active_discovery": false,
                                    "managed": true,
                                    "id": 1,
                                    "space": "undefined",
                                    "resource_uri": "/MAAS/api/2.0/subnets/1/"
                                }
                            }
                        ],
                        "type": "physical",
                        "id": 1,
                        "parents": [],
                        "discovered": null,
                        "enabled": true,
                        "effective_mtu": 1500,
                        "name": "eno1",
                        "children": [],
                        "vlan": {
                            "vid": 0,
                            "mtu": 1500,
                            "dhcp_on": true,
                            "external_dhcp": null,
                            "relay_vlan": null,
                            "primary_rack": "rekyhd",
                            "id": 5001,
                            "name": "untagged",
                            "fabric_id": 0,
                            "secondary_rack": null,
                            "space": "undefined",
                            "fabric": "fabric-0",
                            "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                        },
                        "firmware_version": "0x800004f8",
                        "tags": [],
                        "vendor": "Intel Corporation",
                        "product": "S2600WTTR (SKU Number)",
                        "system_id": "rekyhd",
                        "params": "",
                        "resource_uri": "/MAAS/api/2.0/nodes/rekyhd/interfaces/1/"
                    }
                ],
                "resource_uri": "/MAAS/api/2.0/ipaddresses/"
            }
        ],
        "resource_records": [],
        "fqdn": "163m.com",
        "resource_uri": "/MAAS/api/2.0/dnsresources/98/"
    },
]
```

Next, want to update it's fqdn:

```
$ maas st dnsresource update 98 fqdn=12com
Success.
Machine-readable output follows:
{
    "address_ttl": null,
    "id": 98,
    "ip_addresses": [
        {
            "created": "2018-11-02T10:00:57.200",
            "ip": "10.10.26.163",
            "alloc_type": 1,
            "subnet": {
                "name": "10.10.26.0/24",
                "vlan": {
                    "vid": 0,
                    "mtu": 1500,
                    "dhcp_on": true,
                    "external_dhcp": null,
                    "relay_vlan": null,
                    "primary_rack": "rekyhd",
                    "id": 5001,
                    "name": "untagged",
                    "fabric_id": 0,
                    "secondary_rack": null,
                    "space": "undefined",
                    "fabric": "fabric-0",
                    "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                },
                "cidr": "10.10.26.0/24",
                "rdns_mode": 2,
                "gateway_ip": "10.10.26.0",
                "dns_servers": [],
                "allow_proxy": true,
                "active_discovery": false,
                "managed": true,
                "id": 1,
                "space": "undefined",
                "resource_uri": "/MAAS/api/2.0/subnets/1/"
            },
            "owner": null,
            "alloc_type_name": "Static",
            "interface_set": [
                {
                    "mac_address": "a4:bf:01:51:52:87",
                    "links": [
                        {
                            "id": 1,
                            "mode": "static",
                            "ip_address": "10.10.26.163",
                            "subnet": {
                                "name": "10.10.26.0/24",
                                "vlan": {
                                    "vid": 0,
                                    "mtu": 1500,
                                    "dhcp_on": true,
                                    "external_dhcp": null,
                                    "relay_vlan": null,
                                    "primary_rack": "rekyhd",
                                    "id": 5001,
                                    "name": "untagged",
                                    "fabric_id": 0,
                                    "secondary_rack": null,
                                    "space": "undefined",
                                    "fabric": "fabric-0",
                                    "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                                },
                                "cidr": "10.10.26.0/24",
                                "rdns_mode": 2,
                                "gateway_ip": "10.10.26.0",
                                "dns_servers": [],
                                "allow_proxy": true,
                                "active_discovery": false,
                                "managed": true,
                                "id": 1,
                                "space": "undefined",
                                "resource_uri": "/MAAS/api/2.0/subnets/1/"
                            }
                        }
                    ],
                    "type": "physical",
                    "id": 1,
                    "parents": [],
                    "discovered": null,
                    "enabled": true,
                    "effective_mtu": 1500,
                    "name": "eno1",
                    "children": [],
                    "vlan": {
                        "vid": 0,
                        "mtu": 1500,
                        "dhcp_on": true,
                        "external_dhcp": null,
                        "relay_vlan": null,
                        "primary_rack": "rekyhd",
                        "id": 5001,
                        "name": "untagged",
                        "fabric_id": 0,
                        "secondary_rack": null,
                        "space": "undefined",
                        "fabric": "fabric-0",
                        "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                    },
                    "firmware_version": "0x800004f8",
                    "tags": [],
                    "vendor": "Intel Corporation",
                    "product": "S2600WTTR (SKU Number)",
                    "system_id": "rekyhd",
                    "params": "",
                    "resource_uri": "/MAAS/api/2.0/nodes/rekyhd/interfaces/1/"
                }
            ],
            "resource_uri": "/MAAS/api/2.0/ipaddresses/"
        }
    ],
    "resource_records": [],
    "fqdn": "163m.com",
    "resource_uri": "/MAAS/api/2.0/dnsresources/98/"
}
```

And update ip address also not works although the output says execute successfully.
```
$ maas sensetime dnsresource update 98 ip_address=10.10.26.102
Success.
Machine-readable output follows:
{
    "address_ttl": null,
    "id": 98,
    "ip_addresses": [
        {
            "created": "2018-11-02T10:00:57.200",
            "ip": "10.10.26.163",
            "alloc_type": 1,
            "subnet": {
                "name": "10.10.26.0/24",
                "vlan": {
                    "vid": 0,
                    "mtu": 1500,
                    "dhcp_on": true,
                    "external_dhcp": null,
                    "relay_vlan": null,
                    "primary_rack": "rekyhd",
                    "id": 5001,
                    "name": "untagged",
                    "fabric_id": 0,
                    "secondary_rack": null,
                    "space": "undefined",
                    "fabric": "fabric-0",
                    "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                },
                "cidr": "10.10.26.0/24",
                "rdns_mode": 2,
                "gateway_ip": "10.10.26.0",
                "dns_servers": [],
                "allow_proxy": true,
                "active_discovery": false,
                "managed": true,
                "id": 1,
                "space": "undefined",
                "resource_uri": "/MAAS/api/2.0/subnets/1/"
            },
            "owner": null,
            "alloc_type_name": "Static",
            "interface_set": [
                {
                    "mac_address": "a4:bf:01:51:52:87",
                    "links": [
                        {
                            "id": 1,
                            "mode": "static",
                            "ip_address": "10.10.26.163",
                            "subnet": {
                                "name": "10.10.26.0/24",
                                "vlan": {
                                    "vid": 0,
                                    "mtu": 1500,
                                    "dhcp_on": true,
                                    "external_dhcp": null,
                                    "relay_vlan": null,
                                    "primary_rack": "rekyhd",
                                    "id": 5001,
                                    "name": "untagged",
                                    "fabric_id": 0,
                                    "secondary_rack": null,
                                    "space": "undefined",
                                    "fabric": "fabric-0",
                                    "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                                },
                                "cidr": "10.10.26.0/24",
                                "rdns_mode": 2,
                                "gateway_ip": "10.10.26.0",
                                "dns_servers": [],
                                "allow_proxy": true,
                                "active_discovery": false,
                                "managed": true,
                                "id": 1,
                                "space": "undefined",
                                "resource_uri": "/MAAS/api/2.0/subnets/1/"
                            }
                        }
                    ],
                    "type": "physical",
                    "id": 1,
                    "parents": [],
                    "discovered": null,
                    "enabled": true,
                    "effective_mtu": 1500,
                    "name": "eno1",
                    "children": [],
                    "vlan": {
                        "vid": 0,
                        "mtu": 1500,
                        "dhcp_on": true,
                        "external_dhcp": null,
                        "relay_vlan": null,
                        "primary_rack": "rekyhd",
                        "id": 5001,
                        "name": "untagged",
                        "fabric_id": 0,
                        "secondary_rack": null,
                        "space": "undefined",
                        "fabric": "fabric-0",
                        "resource_uri": "/MAAS/api/2.0/vlans/5001/"
                    },
                    "firmware_version": "0x800004f8",
                    "tags": [],
                    "vendor": "Intel Corporation",
                    "product": "S2600WTTR (SKU Number)",
                    "system_id": "rekyhd",
                    "params": "",
                    "resource_uri": "/MAAS/api/2.0/nodes/rekyhd/interfaces/1/"
                }
            ],
            "resource_uri": "/MAAS/api/2.0/ipaddresses/"
        }
    ],
    "resource_records": [],
    "fqdn": "163m.com",
    "resource_uri": "/MAAS/api/2.0/dnsresources/98/"
}
```

Related branches

Revision history for this message
Mike Pontillo (mpontillo) wrote :

I'd like to take a closer look at what you're doing here before calling this "Triaged".

But since I haven't had time to do that, I was first wondering why you are creating a "com" domain in MAAS. It seems potentially dangerous to tell MAAS it is authoritative for the "com." TLD.

If you create separate domains for each record you would like to represent under the "com" TLD, such as "example.com", why not create an "example.com" domain directly in MAAS? (You can use the `@` record to represent looking up "example.com" itself without a subdomain, just like in BIND.)

Revision history for this message
Jack Chen (scsvip) wrote :

Sorry for the delayed response. In short, I can't use cli to update dns resource. I believe the domain name is not very important. But I will try add 'example.com' and next update the fqdn to see whether update works.

Revision history for this message
Newell Jensen (newell-jensen) wrote :

Jack,

Did you ever end up testing with example.com?

Revision history for this message
Newell Jensen (newell-jensen) wrote :
Download full text (4.2 KiB)

I was able to update the name of the dnsresource using the cli. The docs for this api endpoint were wrong as we should have been using "name" instead of "fqdn":

root@maas-bionic:~# maas admin dnsresources read domain=com
Success.
Machine-readable output follows:
[
    {
        "address_ttl": null,
        "id": 3,
        "ip_addresses": [],
        "fqdn": "something.com",
        "resource_records": [],
        "resource_uri": "/MAAS/api/2.0/dnsresources/3/"
    },
    {
        "address_ttl": null,
        "id": 4,
        "ip_addresses": [
            {
                "created": "2019-05-29T21:52:51.432",
                "ip": "10.0.0.14",
                "alloc_type": 4,
                "subnet": {
                    "name": "10.0.0.0/24",
                    "vlan": {
                        "vid": 0,
                        "mtu": 1500,
                        "dhcp_on": true,
                        "external_dhcp": null,
                        "relay_vlan": null,
                        "id": 5002,
                        "name": "untagged",
                        "fabric": "fabric-1",
                        "space": "undefined",
                        "secondary_rack": null,
                        "fabric_id": 1,
                        "primary_rack": "6ef4cn",
                        "resource_uri": "/MAAS/api/2.0/vlans/5002/"
                    },
                    "cidr": "10.0.0.0/24",
                    "rdns_mode": 2,
                    "gateway_ip": "10.0.0.1",
                    "dns_servers": [],
                    "allow_dns": true,
                    "allow_proxy": true,
                    "active_discovery": false,
                    "managed": true,
                    "id": 2,
                    "space": "undefined",
                    "resource_uri": "/MAAS/api/2.0/subnets/2/"
                },
                "alloc_type_name": "User reserved",
                "interface_set": [],
                "owner": {
                    "is_superuser": true,
                    "username": "admin",
                    "email": "<email address hidden>",
                    "is_local": true,
                    "resource_uri": "/MAAS/api/2.0/users/admin/"
                },
                "resource_uri": "/MAAS/api/2.0/ipaddresses/"
            }
        ],
        "fqdn": "yodawg.com",
        "resource_records": [],
        "resource_uri": "/MAAS/api/2.0/dnsresources/4/"
    }
]
root@maas-bionic:~# maas admin dnsresource update 4 name=yodel
Success.
Machine-readable output follows:
{
    "address_ttl": null,
    "fqdn": "yodel.com",
    "resource_records": [],
    "ip_addresses": [
        {
            "created": "2019-05-29T21:52:51.432",
            "ip": "10.0.0.14",
            "alloc_type": 4,
            "subnet": {
                "name": "10.0.0.0/24",
                "vlan": {
                    "vid": 0,
                    "mtu": 1500,
                    "dhcp_on": true,
                    "external_dhcp": null,
                    "relay_vlan": null,
                    "name": "untagged",
                    "id": 5002,
                    "primary_rack": "6ef4cn",
                    "fabric_...

Read more...

Changed in maas:
assignee: nobody → Newell Jensen (newell-jensen)
status: New → In Progress
importance: Undecided → Medium
milestone: none → 2.6.0rc2
Revision history for this message
Newell Jensen (newell-jensen) wrote :

After looking at this some more, update should allow us to modify the same fields that create is for the dnsresources endpoint.

Changed in maas:
milestone: 2.6.0rc2 → 2.7.0beta1
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.