Project

General

Profile

Actions

Bug #14267

closed

Host creation error

Added by Alexandre Barth about 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Foreman commands (obsolete)
Target version:
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

hammer -u admin -p changeme -d host create --build false --enabled false --hostgroup ESXi-Prod --model 'IBM 3650 M4' --interface='primary=true,provision=true,ip=192.168.0.1,mac=34:40:b5:9f:fe:64' --parameters ipvmotion1=192.168.0.2,ipvmotion2=192.168.0.3,ipft=192.168.0.4 --name esxi1

[ INFO 2016-03-18 13:53:39 Init] Initialization of Hammer CLI (0.6.1) has started...

[DEBUG 2016-03-18 13:53:39 Init] Running at ruby 2.2.2-p95

[ INFO 2016-03-18 13:53:39 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded

[ INFO 2016-03-18 13:53:39 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded

[ INFO 2016-03-18 13:53:39 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded

[DEBUG 2016-03-18 13:53:39 Connection] Registered: foreman

[DEBUG 2016-03-18 13:53:39 API] Global headers: {

        :content_type => "application/json",

              :accept => "application/json;version=2",

    "Accept-Language" => "en" 

}

[ INFO 2016-03-18 13:53:39 Modules] Extension module hammer_cli_foreman (0.6.1) loaded

[DEBUG 2016-03-18 13:53:39 Init] Using locale 'en'

[DEBUG 2016-03-18 13:53:39 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/locale'

[DEBUG 2016-03-18 13:53:39 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.1/locale'

[ INFO 2016-03-18 13:53:39 HammerCLI::MainCommand] Called with options: {"option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}

[ INFO 2016-03-18 13:53:40 HammerCLIForeman::Host] Called with options: {}

[ INFO 2016-03-18 13:53:40 HammerCLIForeman::Host::CreateCommand] Called with options: {"option_managed"=>true, "option_build"=>false, "option_enabled"=>false, "option_overwrite"=>true, "option_parameters"=>{"ipvmotion1"=>"192.168.0.2", "ipvmotion2"=>"192.168.0.3", "ipft"=>"192.168.0.4"}, "option_volume_list"=>[], "option_interface_list"=>[{"primary"=>"true", "provision"=>"true", "ip"=>"192.168.0.1", "mac"=>"34:40:b5:9f:fe:64"}], "option_model_name"=>"IBM 3650 M4", "option_hostgroup_name"=>"ESXi-Prod", "option_name"=>"esxi1"}

[ INFO 2016-03-18 13:53:40 API] GET /api/models

[DEBUG 2016-03-18 13:53:40 API] Params: {

    :search => "name = \"IBM 3650 M4\"" 

}

[DEBUG 2016-03-18 13:53:40 API] Headers: {

    :params => {

        :search => "name = \"IBM 3650 M4\"" 

    }

}

[DEBUG 2016-03-18 13:53:40 API] Response: {

       "total" => 3,

    "subtotal" => 1,

        "page" => 1,

    "per_page" => 200,

      "search" => "name = \"IBM 3650 M4\"",

        "sort" => {

           "by" => nil,

        "order" => nil

    },

     "results" => [

        [0] {

                      "info" => nil,

                "created_at" => "2016-03-18 10:53:58 UTC",

                "updated_at" => "2016-03-18 10:53:58 UTC",

              "vendor_class" => nil,

            "hardware_model" => nil,

                        "id" => 3,

                      "name" => "IBM 3650 M4" 

        }

    ]

}

[DEBUG 2016-03-18 13:53:40 API] Response headers: {

                      :date => "Fri, 18 Mar 2016 12:53:40 GMT",

                    :server => "Apache/2.4.6 (CentOS)",

           :x_frame_options => "SAMEORIGIN",

          :x_xss_protection => "1; mode=block",

    :x_content_type_options => "nosniff",

           :foreman_version => "1.11.0-RC2",

       :foreman_api_version => "2",

           :apipie_checksum => "570fbf5ac07f630954eaafb65d8e5f09",

             :cache_control => "max-age=0, private, must-revalidate",

              :x_request_id => "6912e45d-3aa2-4584-83ad-10af426cf468",

                 :x_runtime => "0.070864",

              :x_powered_by => "Phusion Passenger 4.0.18",

                :set_cookie => [

        [0] "_session_id=9693c55a4b691ae5025dc4d90be03aa3; path=/; expires=Sat, 19 Mar 2016 12:53:40 -0000; HttpOnly" 

    ],

                      :etag => "\"c4b642d41818e1a0391fb28b7fb511a7-gzip\"",

                    :status => "200 OK",

                      :vary => "Accept-Encoding",

          :content_encoding => "gzip",

            :content_length => "221",

                :connection => "close",

              :content_type => "application/json; charset=utf-8" 

}

[ INFO 2016-03-18 13:53:40 API] GET /api/hostgroups

[DEBUG 2016-03-18 13:53:40 API] Params: {

    :search => "name = \"ESXi-Prod\"" 

}

[DEBUG 2016-03-18 13:53:40 API] Headers: {

    :params => {

        :search => "name = \"ESXi-Prod\"" 

    }

}

[DEBUG 2016-03-18 13:53:40 API] Response: {

       "total" => 44,

    "subtotal" => 1,

        "page" => 1,

    "per_page" => 200,

      "search" => "name = \"ESXi-Prod\"",

        "sort" => {

           "by" => nil,

        "order" => nil

    },

     "results" => [

        [0] {

                       "subnet_id" => 3,

                     "subnet_name" => "ADMIN",

              "operatingsystem_id" => 5,

            "operatingsystem_name" => "ESXi 6.0",

                       "domain_id" => 1,

                     "domain_name" => "test-domain.com",

                  "environment_id" => 1,

                "environment_name" => "production",

              "compute_profile_id" => nil,

            "compute_profile_name" => nil,

                        "ancestry" => nil,

                       "parent_id" => nil,

                     "parent_name" => nil,

                 "puppet_proxy_id" => nil,

              "puppet_ca_proxy_id" => nil,

                       "ptable_id" => 81,

                     "ptable_name" => "Redhat_ESXi",

                       "medium_id" => 11,

                     "medium_name" => "ESXi-mirror",

                 "architecture_id" => 1,

               "architecture_name" => "x86_64",

                        "realm_id" => nil,

                      "realm_name" => nil,

                      "created_at" => "2016-03-18 10:57:26 UTC",

                      "updated_at" => "2016-03-18 10:57:26 UTC",

                              "id" => 1,

                            "name" => "ESXi-Prod",

                           "title" => "ESXi-Prod" 

        }

    ]

}

[DEBUG 2016-03-18 13:53:40 API] Response headers: {

                      :date => "Fri, 18 Mar 2016 12:53:40 GMT",

                    :server => "Apache/2.4.6 (CentOS)",

           :x_frame_options => "SAMEORIGIN",

          :x_xss_protection => "1; mode=block",

    :x_content_type_options => "nosniff",

           :foreman_version => "1.11.0-RC2",

       :foreman_api_version => "2",

           :apipie_checksum => "570fbf5ac07f630954eaafb65d8e5f09",

             :cache_control => "max-age=0, private, must-revalidate",

              :x_request_id => "7e5955f7-d29b-4856-8849-d1b61c1392f8",

                 :x_runtime => "0.104288",

              :x_powered_by => "Phusion Passenger 4.0.18",

                :set_cookie => [

        [0] "_session_id=c7de329272941a90cc46ccd39ca5dc68; path=/; expires=Sat, 19 Mar 2016 12:53:40 -0000; HttpOnly" 

    ],

                      :etag => "\"55cd26055809946aaef41bbb0fe2df6e-gzip\"",

                    :status => "200 OK",

                      :vary => "Accept-Encoding",

          :content_encoding => "gzip",

            :content_length => "400",

                :connection => "close",

              :content_type => "application/json; charset=utf-8" 

}

[ERROR 2016-03-18 13:53:40 Exception] Error: undefined method `[]' for nil:NilClass

Could not create the host:

  Error: undefined method `[]' for nil:NilClass

[ERROR 2016-03-18 13:53:40 Exception]

NoMethodError (undefined method `[]' for nil:NilClass):

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.1/lib/hammer_cli_foreman/host.rb:153:in `block in check_mandatory_interfaces'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.1/lib/hammer_cli_foreman/host.rb:153:in `any?'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.1/lib/hammer_cli_foreman/host.rb:153:in `check_mandatory_interfaces'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.1/lib/hammer_cli_foreman/host.rb:94:in `request_params'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/lib/hammer_cli/apipie/command.rb:43:in `send_request'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.1/lib/hammer_cli_foreman/commands.rb:189:in `send_request'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/lib/hammer_cli/apipie/command.rb:34:in `execute'

    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/lib/hammer_cli/abstract.rb:22:in `run'

    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'

    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/lib/hammer_cli/abstract.rb:22:in `run'

    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'

    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/lib/hammer_cli/abstract.rb:22:in `run'

    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'

    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/bin/hammer:125:in `<top (required)>'

    /bin/hammer:23:in `load'

    /bin/hammer:23:in `<main>'
2016-03-18 13:53:40 [app] [I] Started GET "/api/models?search=name+%3D+%22IBM+3650+M4%22" for 192.168.0.100 at 2016-03-18 13:53:40 +0100

2016-03-18 13:53:40 [app] [I] Processing by Api::V2::ModelsController#index as JSON

2016-03-18 13:53:40 [app] [I]   Parameters: {"search"=>"name = \"IBM 3650 M4\"", "apiv"=>"v2", "model"=>{}}

2016-03-18 13:53:40 [app] [I] Authorized user admin(foremanadmin CTIBruz)

2016-03-18 13:53:40 [app] [I]   Rendered api/v2/models/index.rabl within api/v2/layouts/index_layout (4.6ms)

2016-03-18 13:53:40 [app] [I] Completed 200 OK in 43ms (Views: 9.9ms | ActiveRecord: 12.8ms)

2016-03-18 13:53:40 [app] [I] Started GET "/api/hostgroups?search=name+%3D+%22ESXi-Prod%22" for 192.168.0.100 at 2016-03-18 13:53:40 +0100

2016-03-18 13:53:40 [app] [I] Processing by Api::V2::HostgroupsController#index as JSON

2016-03-18 13:53:40 [app] [I]   Parameters: {"search"=>"name = \"ESXi-Prod\"", "apiv"=>"v2", "hostgroup"=>{}}

2016-03-18 13:53:40 [app] [I] Authorized user admin(foremanadmin CTIBruz)

2016-03-18 13:53:40 [app] [I]   Rendered api/v2/hostgroups/index.json.rabl within api/v2/layouts/index_layout (50.3ms)

2016-03-18 13:53:40 [app] [I] Completed 200 OK in 83ms (Views: 55.3ms | ActiveRecord: 9.1ms)

Related issues 1 (0 open1 closed)

Related to Hammer CLI - Bug #13927: Specifying provision and primary flags should not be mandatoryClosedMarek Hulán02/27/2016Actions
Actions #1

Updated by Dominic Cleal about 8 years ago

  • Description updated (diff)
  • Category set to Foreman commands (obsolete)
  • translation missing: en.field_release set to 71
Actions #2

Updated by Dominic Cleal about 8 years ago

  • Related to Bug #13927: Specifying provision and primary flags should not be mandatory added
Actions #3

Updated by Dominic Cleal about 8 years ago

#13927 removes this buggy code, we could take that into 0.6.x and it'd fix the problem.

Actions #4

Updated by Dominic Cleal about 8 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Dominic Cleal
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/224 added
Actions #5

Updated by Alexandre Barth about 8 years ago

Thank you Dominic, it is working now with this fix.

Actions #6

Updated by Dominic Cleal about 8 years ago

Thanks for testing it out, I'm hoping to make an RC3 this week including this fix.

Actions #7

Updated by Dominic Cleal about 8 years ago

  • Status changed from Ready For Testing to Closed

Merged in 013a886.

Actions

Also available in: Atom PDF