Project

General

Profile

Actions

Bug #7975

closed

Querying subnets by name no longer works

Added by Jiri Stransky over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When querying subnets via the API, only querying by ID works, not querying by name. Example:


curl -s -k -u admin:changeme https://r6-staypuft/api/subnets | python -m json.tool
[
    {
        "subnet": {
            "dhcp_id": 1, 
            "dns_id": 1, 
            "dns_primary": "192.168.130.5", 
            "dns_secondary": null, 
            "domain_ids": [
                1
            ], 
            "from": "192.168.130.100", 
            "gateway": "192.168.130.1", 
            "id": 1, 
            "ipam": "DHCP", 
            "mask": "255.255.255.0", 
            "name": "default", 
            "network": "192.168.130.0", 
            "priority": null, 
            "tftp_id": 1, 
            "to": "192.168.130.254", 
            "vlanid": null
        }
    }
]

[root@r6-staypuft ~]# curl -s -k -u admin:changeme https://r6-staypuft/api/subnets/1 | python -m json.tool
{
    "subnet": {
        "cidr": 24, 
        "dhcp": {
            "id": 1, 
            "name": "r6-staypuft.example.org", 
            "url": "https://r6-staypuft.example.org:8443" 
        }, 
        "dhcp_id": 1, 
        "dns": {
            "id": 1, 
            "name": "r6-staypuft.example.org", 
            "url": "https://r6-staypuft.example.org:8443" 
        }, 
        "dns_id": 1, 
        "dns_primary": "192.168.130.5", 
        "dns_secondary": null, 
        "domain_ids": [
            1
        ], 
        "from": "192.168.130.100", 
        "gateway": "192.168.130.1", 
        "id": 1, 
        "ipam": "DHCP", 
        "mask": "255.255.255.0", 
        "name": "default", 
        "network": "192.168.130.0", 
        "priority": null, 
        "tftp": {
            "id": 1, 
            "name": "r6-staypuft.example.org", 
            "url": "https://r6-staypuft.example.org:8443" 
        }, 
        "tftp_id": 1, 
        "to": "192.168.130.254", 
        "vlanid": null
    }
}

[root@r6-staypuft ~]# curl -s -k -u admin:changeme https://r6-staypuft/api/subnets/default | python -m json.tool
{
    "message": "Resource subnet not found by id 'default'" 
}

Actions #1

Updated by Dominic Cleal over 9 years ago

  • Category set to API
  • Target version set to 1.7.2
  • translation missing: en.field_release set to 21
Actions #2

Updated by Shlomi Zadok over 9 years ago

  • Status changed from New to Feedback
  • Assignee set to Shlomi Zadok

On subnets, we use a combination of the id & name (as defined in def to_param, see subnet.rb )

The right api call would be curl -s -k -u admin:changeme https://r6-staypuft/api/subnets/1-default | python -m json.tool

Actions #3

Updated by Dominic Cleal over 9 years ago

  • Status changed from Feedback to New

The API should accept the ID or the name as per the docs (http://theforeman.org/manuals/1.6/index.html#5.1API). We've never used "id-name" as an identifier in the API.

Actions #4

Updated by The Foreman Bot over 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1867 added
  • Pull request deleted ()
Actions #5

Updated by Shlomi Zadok over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF