Project

General

Profile

Actions

Bug #16380

closed

host list does not include all atributes when i to try to sort by IP or MAC

Added by Martin Bacovsky over 7 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

select host list without sort:

hammer host list --hostgroup-title general_server/DN
--------|---------------|------------------|------------|----------|------------------
ID      | NAME          | OPERATING SYSTEM | HOST GROUP | IP       | MAC
--------|---------------|------------------|------------|----------|------------------
150666  | dn001.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.10 | a1:b2:c3:d4:e5:57
150678  | dn002.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.11 | a1:b2:c3:d4:e5:19
150688  | dn003.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.12 | a1:b2:c3:d4:e5:1f
193119  | dn004.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.13 | a1:b2:c3:d4:e5:f1
330874  | dn005.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.14 | a1:b2:c3:d4:e5:b1
379538  | dn006.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.15 | a1:b2:c3:d4:e5:df
193122  | dn007.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.16 | a1:b2:c3:d4:e5:59
193121  | dn008.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.17 | a1:b2:c3:d4:e5:97
193576  | dn009.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.18 | a1:b2:c3:d4:e5:57
193565  | dn010.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.19 | a1:b2:c3:d4:e5:19
193566  | dn011.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.20 | a1:b2:c3:d4:e5:9f
193567  | dn012.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.21 | a1:b2:c3:d4:e5:d9
193564  | dn013.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.22 | a1:b2:c3:d4:e5:5f
232138  | dn014.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.23 | a1:b2:c3:d4:e5:59
193200  | dn015.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.24 | a1:b2:c3:d4:e5:17
193552  | dn016.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.25 | a1:b2:c3:d4:e5:57
193560  | dn017.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.26 | a1:b2:c3:d4:e5:d9
2289696 | dn018.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.27 | a1:b2:c3:d4:e5:f1
2284342 | dn019.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.28 | a1:b2:c3:d4:e5:99
2284124 | dn020.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.29 | a1:b2:c3:d4:e5:31
2283754 | dn021.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.30 | a1:b2:c3:d4:e5:1f
2277706 | dn022.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.31 | a1:b2:c3:d4:e5:5f
2274149 | dn023.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.32 | a1:b2:c3:d4:e5:b1
2274043 | dn024.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.33 | a1:b2:c3:d4:e5:97
193563  | dn025.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.34 | a1:b2:c3:d4:e5:99
193571  | dn026.abc.com | CentOS 7.2       | DataNodes  | 1.2.3.35 | a1:b2:c3:d4:e5:d7
--------|---------------|------------------|------------|----------|------------------

select host list with sort ip:

hammer host list --hostgroup-title general_server/DN --order ip
--------|---------------|------------------|------------|----------|------------------
ID      | NAME          | OPERATING SYSTEM | HOST GROUP | IP       | MAC
--------|---------------|------------------|------------|----------|------------------
150666  | dn001.abc.com | CentOS 7.2       | DataNodes  |          | 
150678  | dn002.abc.com | CentOS 7.2       | DataNodes  |          | 
150688  | dn003.abc.com | CentOS 7.2       | DataNodes  |          | 
193119  | dn004.abc.com | CentOS 7.2       | DataNodes  |          | 
330874  | dn005.abc.com | CentOS 7.2       | DataNodes  |          | 
379538  | dn006.abc.com | CentOS 7.2       | DataNodes  |          | 
193122  | dn007.abc.com | CentOS 7.2       | DataNodes  |          | 
193121  | dn008.abc.com | CentOS 7.2       | DataNodes  |          | 
193576  | dn009.abc.com | CentOS 7.2       | DataNodes  |          | 
193565  | dn010.abc.com | CentOS 7.2       | DataNodes  |          | 
193566  | dn011.abc.com | CentOS 7.2       | DataNodes  |          | 
193567  | dn012.abc.com | CentOS 7.2       | DataNodes  |          | 
193564  | dn013.abc.com | CentOS 7.2       | DataNodes  |          | 
232138  | dn014.abc.com | CentOS 7.2       | DataNodes  |          | 
193200  | dn015.abc.com | CentOS 7.2       | DataNodes  |          | 
193552  | dn016.abc.com | CentOS 7.2       | DataNodes  |          | 
193560  | dn017.abc.com | CentOS 7.2       | DataNodes  |          | 
2289696 | dn018.abc.com | CentOS 7.2       | DataNodes  |          | 
2284342 | dn019.abc.com | CentOS 7.2       | DataNodes  |          | 
2284124 | dn020.abc.com | CentOS 7.2       | DataNodes  |          | 
2283754 | dn021.abc.com | CentOS 7.2       | DataNodes  |          | 
2277706 | dn022.abc.com | CentOS 7.2       | DataNodes  |          | 
2274149 | dn023.abc.com | CentOS 7.2       | DataNodes  |          | 
2274043 | dn024.abc.com | CentOS 7.2       | DataNodes  |          | 
193563  | dn025.abc.com | CentOS 7.2       | DataNodes  |          | 
193571  | dn026.abc.com | CentOS 7.2       | DataNodes  |          | 
--------|---------------|------------------|------------|----------|------------------

select host list with sort mac:

hammer host list --hostgroup-title general_server/DN --order mac
--------|---------------|------------------|------------|----------|------------------
ID      | NAME          | OPERATING SYSTEM | HOST GROUP | IP       | MAC
--------|---------------|------------------|------------|----------|------------------
150666  | dn001.abc.com | CentOS 7.2       | DataNodes  |          | 
150678  | dn002.abc.com | CentOS 7.2       | DataNodes  |          | 
150688  | dn003.abc.com | CentOS 7.2       | DataNodes  |          | 
193119  | dn004.abc.com | CentOS 7.2       | DataNodes  |          | 
330874  | dn005.abc.com | CentOS 7.2       | DataNodes  |          | 
379538  | dn006.abc.com | CentOS 7.2       | DataNodes  |          | 
193122  | dn007.abc.com | CentOS 7.2       | DataNodes  |          | 
193121  | dn008.abc.com | CentOS 7.2       | DataNodes  |          | 
193576  | dn009.abc.com | CentOS 7.2       | DataNodes  |          | 
193565  | dn010.abc.com | CentOS 7.2       | DataNodes  |          | 
193566  | dn011.abc.com | CentOS 7.2       | DataNodes  |          | 
193567  | dn012.abc.com | CentOS 7.2       | DataNodes  |          | 
193564  | dn013.abc.com | CentOS 7.2       | DataNodes  |          | 
232138  | dn014.abc.com | CentOS 7.2       | DataNodes  |          | 
193200  | dn015.abc.com | CentOS 7.2       | DataNodes  |          | 
193552  | dn016.abc.com | CentOS 7.2       | DataNodes  |          | 
193560  | dn017.abc.com | CentOS 7.2       | DataNodes  |          | 
2289696 | dn018.abc.com | CentOS 7.2       | DataNodes  |          | 
2284342 | dn019.abc.com | CentOS 7.2       | DataNodes  |          | 
2284124 | dn020.abc.com | CentOS 7.2       | DataNodes  |          | 
2283754 | dn021.abc.com | CentOS 7.2       | DataNodes  |          | 
2277706 | dn022.abc.com | CentOS 7.2       | DataNodes  |          | 
2274149 | dn023.abc.com | CentOS 7.2       | DataNodes  |          | 
2274043 | dn024.abc.com | CentOS 7.2       | DataNodes  |          | 
193563  | dn025.abc.com | CentOS 7.2       | DataNodes  |          | 
193571  | dn026.abc.com | CentOS 7.2       | DataNodes  |          | 
--------|---------------|------------------|------------|----------|------------------

$ hammer --version
hammer (0.7.0) * hammer_cli_foreman (0.7.0) * hammer_cli_foreman_discovery (0.0.3)

Foreman version:
Version 1.12.2

API response seen in hammer debug output is missing some attributes:

[ INFO 2016-08-30T11:34:30 API] GET /api/hosts
[DEBUG 2016-08-30T11:34:30 API] Params: {
       "order" => "mac",
        "page" => 1,
    "per_page" => 40
}
[DEBUG 2016-08-30T11:34:30 API] Headers: {
    :params => {
           "order" => "mac",
            "page" => 1,
        "per_page" => 40
    }
}
[DEBUG 2016-08-30T11:34:31 API] Response: {
       "total" => 1,
    "subtotal" => 1,
        "page" => 1,
    "per_page" => 40,
      "search" => nil,
        "sort" => {
           "by" => "mac",
        "order" => "ASC" 
    },
     "results" => [
        [0] {
                                    "ip" => nil,
                        "environment_id" => 1,
                      "environment_name" => "production",
                           "last_report" => "2016-08-30 09:21:27 UTC",
                                   "mac" => nil,
                              "realm_id" => nil,
                            "realm_name" => nil,
                                "sp_mac" => nil,
                                 "sp_ip" => nil,
                               "sp_name" => nil,
                             "domain_id" => nil,
                           "domain_name" => nil,
                       "architecture_id" => 1,
                     "architecture_name" => "x86_64",
                    "operatingsystem_id" => 1,
                  "operatingsystem_name" => "CentOS Linux 7.2.1511",
                             "subnet_id" => nil,
                           "subnet_name" => nil,
                          "sp_subnet_id" => nil,
                             "ptable_id" => nil,
                           "ptable_name" => nil,
                             "medium_id" => nil,
                           "medium_name" => nil,
                                 "build" => false,
                               "comment" => nil,
                                  "disk" => nil,
                          "installed_at" => nil,
                              "model_id" => 1,
                          "hostgroup_id" => nil,
                              "owner_id" => nil,
                            "owner_type" => nil,
                               "enabled" => true,
                    "puppet_ca_proxy_id" => 1,
                               "managed" => false,
                             "use_image" => nil,
                            "image_file" => "",
                                  "uuid" => nil,
                   "compute_resource_id" => nil,
                 "compute_resource_name" => nil,
                    "compute_profile_id" => nil,
                  "compute_profile_name" => nil,
                          "capabilities" => [
                [0] "build" 
            ],
                      "provision_method" => "build",
                       "puppet_proxy_id" => 1,
                              "certname" => "nec-em19.rhts.eng.bos.redhat.com",
                              "image_id" => nil,
                            "image_name" => nil,
                            "created_at" => "2016-08-29 16:21:37 UTC",
                            "updated_at" => "2016-08-30 09:21:33 UTC",
                          "last_compile" => "2016-08-30 09:21:31 UTC",
                         "global_status" => 0,
                   "global_status_label" => "OK",
                         "puppet_status" => 0,
                            "model_name" => "MP Server",
                  "configuration_status" => 0,
            "configuration_status_label" => "No changes",
                                  "name" => "nec-em19.rhts.eng.bos.redhat.com",
                                    "id" => 1,
                        "hostgroup_name" => nil,
                       "hostgroup_title" => nil
        }
    ]
}

The same list without ordering return:

[ INFO 2016-08-30T11:34:21 API] GET /api/hosts
[DEBUG 2016-08-30T11:34:21 API] Params: {
        "page" => 1,
    "per_page" => 40
}
[DEBUG 2016-08-30T11:34:21 API] Headers: {
    :params => {
            "page" => 1,
        "per_page" => 40
    }
}
[DEBUG 2016-08-30T11:34:21 API] Response: {
       "total" => 1,
    "subtotal" => 1,
        "page" => 1,
    "per_page" => 40,
      "search" => nil,
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
                                    "ip" => "10.16.64.173",
                        "environment_id" => 1,
                      "environment_name" => "production",
                           "last_report" => "2016-08-30 09:21:27 UTC",
                                   "mac" => "00:15:17:0e:a0:5e",
                              "realm_id" => nil,
                            "realm_name" => nil,
                                "sp_mac" => nil,
                                 "sp_ip" => nil,
                               "sp_name" => nil,
                             "domain_id" => 1,
                           "domain_name" => "rhts.eng.bos.redhat.com",
                       "architecture_id" => 1,
                     "architecture_name" => "x86_64",
                    "operatingsystem_id" => 1,
                  "operatingsystem_name" => "CentOS Linux 7.2.1511",
                             "subnet_id" => nil,
                           "subnet_name" => nil,
                          "sp_subnet_id" => nil,
                             "ptable_id" => nil,
                           "ptable_name" => nil,
                             "medium_id" => nil,
                           "medium_name" => nil,
                                 "build" => false,
                               "comment" => nil,
                                  "disk" => nil,
                          "installed_at" => nil,
                              "model_id" => 1,
                          "hostgroup_id" => nil,
                              "owner_id" => nil,
                            "owner_type" => nil,
                               "enabled" => true,
                    "puppet_ca_proxy_id" => 1,
                               "managed" => false,
                             "use_image" => nil,
                            "image_file" => "",
                                  "uuid" => nil,
                   "compute_resource_id" => nil,
                 "compute_resource_name" => nil,
                    "compute_profile_id" => nil,
                  "compute_profile_name" => nil,
                          "capabilities" => [
                [0] "build" 
            ],
                      "provision_method" => "build",
                       "puppet_proxy_id" => 1,
                              "certname" => "nec-em19.rhts.eng.bos.redhat.com",
                              "image_id" => nil,
                            "image_name" => nil,
                            "created_at" => "2016-08-29 16:21:37 UTC",
                            "updated_at" => "2016-08-30 09:21:33 UTC",
                          "last_compile" => "2016-08-30 09:21:31 UTC",
                         "global_status" => 0,
                   "global_status_label" => "OK",
                         "puppet_status" => 0,
                            "model_name" => "MP Server",
                  "configuration_status" => 0,
            "configuration_status_label" => "No changes",
                                  "name" => "nec-em19.rhts.eng.bos.redhat.com",
                                    "id" => 1,
                        "hostgroup_name" => nil,
                       "hostgroup_title" => nil
        }
    ]
}

By comparison the attrs ip, mac, domain_id and domain_name is lost with ordering.

Actions #1

Updated by Shlomi Zadok over 7 years ago

  • Assignee set to Shlomi Zadok
Actions #2

Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3815 added
Actions #3

Updated by Marek Hulán over 7 years ago

  • Target version set to 1.5.3
Actions #4

Updated by Shlomi Zadok over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 181
Actions

Also available in: Atom PDF