Project

General

Profile

Bug #15174

Updated by Marek Hulán almost 8 years ago

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1337947  
  Description of problem: 
 Hammer does not check all parameters if multiple filters are supplied, e.g. supplying both organization-id and location-id then the location-id is ignored. There is also no error that both are mutual exclusive. 

 See below a test that location-id is completly ignored, even the validation check of the id is not done: 

 <pre> 
 [crash] root@li-lc-1578:~# hammer -d -c/opt/hoici/etc/sat6/hammer-hoici.yaml environment list --organization-id=3 --location-id=999999 
 [ INFO 2016-05-20 14:01:43 Init] Initialization of Hammer CLI (0.5.1.5) has started... 
 [DEBUG 2016-05-20 14:01:43 Init] Running at ruby 2.2.2-p95 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/csv.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_remote_execution.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded 
 [ INFO 2016-05-20 14:01:43 Init] Configuration from the file /opt/hoici/etc/sat6/hammer-hoici.yaml has been loaded 
 [DEBUG 2016-05-20 14:01:43 Connection] Registered: foreman 
 [DEBUG 2016-05-20 14:01:43 API] Global headers: { 
         :content_type => "application/json", 
               :accept => "application/json;version=2", 
     "Accept-Language" => "en" 
 } 
 [ INFO 2016-05-20 14:01:44 Modules] Extension module hammer_cli_foreman (0.5.1.4) loaded 
 [ INFO 2016-05-20 14:01:44 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded 
 [ INFO 2016-05-20 14:01:44 Modules] Extension module hammer_cli_foreman_discovery (0.0.2.1) loaded 
 [ WARN 2016-05-20 14:01:44 HammerCLIForemanRemoteExecution::JobInvocation] Resource 'job_invocations' does not exist in the API 
 [ WARN 2016-05-20 14:01:44 HammerCLIForemanRemoteExecution::JobTemplate] Resource 'job_templates' does not exist in the API 
 [ WARN 2016-05-20 14:01:44 HammerCLIForemanRemoteExecution::TemplateInput] Resource 'template_inputs' does not exist in the API 
 [ WARN 2016-05-20 14:01:44 HammerCLIForemanRemoteExecution::ForeignInputSet] Resource 'foreign_input_sets' does not exist in the API 
 [ WARN 2016-05-20 14:01:44 HammerCLIForemanRemoteExecution::RemoteExecutionFeature] Resource 'remote_execution_features' does not exist in the API 
 [ INFO 2016-05-20 14:01:44 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed. 
 [ INFO 2016-05-20 14:01:44 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created. 
 [ INFO 2016-05-20 14:01:45 Modules] Extension module hammer_cli_gutterball (1.0.1) loaded 
 [ INFO 2016-05-20 14:01:45 Modules] Extension module hammer_cli_import (0.10.23) loaded 
 [ INFO 2016-05-20 14:01:45 Modules] Extension module hammer_cli_katello (0.0.22.6) loaded 
 [DEBUG 2016-05-20 14:01:45 Init] Using locale 'en' 
 [DEBUG 2016-05-20 14:01:45 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.5/locale' 
 [DEBUG 2016-05-20 14:01:45 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.4/locale' 
 [DEBUG 2016-05-20 14:01:45 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale' 
 [DEBUG 2016-05-20 14:01:45 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.6/locale' 
 [ INFO 2016-05-20 14:01:45 HammerCLI::MainCommand] Called with options: {"option_debug"=>true, "option_config"=>"/opt/hoici/etc/sat6/hammer-hoici.yaml"} 
 [ INFO 2016-05-20 14:01:45 HammerCLIForeman::Environment] Called with options: {} 
 [ INFO 2016-05-20 14:01:45 HammerCLIForeman::Environment::ListCommand] Called with options: {"option_location_id"=>999999, "option_organization_id"=>3} 
 [ INFO 2016-05-20 14:01:45 API] GET /api/locations/999999/environments 
 [DEBUG 2016-05-20 14:01:45 API] Params: { 
     "organization_id" => 3, 
                "page" => 1, 
            "per_page" => 1000 
 } 
 [DEBUG 2016-05-20 14:01:45 API] Headers: { 
     :params => { 
         "organization_id" => 3, 
                    "page" => 1, 
                "per_page" => 1000 
     } 
 } 
 [DEBUG 2016-05-20 14:01:46 API] Response: { 
        "total" => 15, 
     "subtotal" => 15, 
         "page" => 1, 
     "per_page" => 1000, 
       "search" => nil, 
         "sort" => { 
            "by" => nil, 
         "order" => nil 
     }, 
      "results" => [ 
         [ 0] { 
             "created_at" => "2016-05-19 20:16:27 UTC", 
             "updated_at" => "2016-05-19 20:16:27 UTC", 
                   "name" => "KT_Hilti_Library_hg_crash_57", 
                     "id" => 29 
         }, 
 .... 
                     :status => "200 OK", 
                       :vary => "Accept-Encoding", 
           :content_encoding => "gzip", 
             :content_length => "510", 
               :content_type => "application/json; charset=utf-8" 
 } 
 </pre> 

 <pre> 
 ---|--------------------------------------------------- 
 ID | NAME 
 ---|--------------------------------------------------- 
 29 | KT_Hilti_Library_hg_crash_57 
 ... 
 1    | production 
 ---|--------------------------------------------------- 
 </pre> 


 Version-Release number of selected component (if applicable): 


 How reproducible: 


 Steps to Reproduce: 
 1. Run hammer with both organization-id and location-id=999999 
 2. 
 3. 

 Actual results: 
 No errors, results for the whole organization returned 

 Expected results: 
 - Results that match both organization-id and location-id are returned 
 - Location-id is checked on validation 

 Additional info:

Back