softlayer / knife-softlayer

Other
25 stars 22 forks source link

Fog not picking up SoftLayer credentials #12

Closed ersteinmIBM closed 9 years ago

ersteinmIBM commented 10 years ago

After upgrading from 0.1.3 to 0.3.2, I cannot use the plugin due to this error: ERROR: ArgumentError: Missing required arguments: softlayer_username, softlayer_api_key

I have confirmed that my SL credentials are in the knife.rb used by knife, but this error still comes up. I assume this is related to the switch to Fog?

cphrmky commented 10 years ago

My initial guess is that what you have in your knife.rb isn't formatted quite correctly, or that your knife.rb isn't readable by the gem. This example includes the knife.rb softlayer settings if you want to double check the syntax/spelling.

ersteinmIBM commented 10 years ago

I put my SL credentials into ~/.fog and the tool got past that error. It looks like, while trying to determine what vlan's to use, the fog network components are trying to log into softlayer. Placing a "puts caller" and "puts config" statement on line 95 and 96 of lib/fog/core/service.rb results in to two stack traces.

The first looks normal: {:softlayer_username=>"myusername", :softlayer_api_key=>"myapikey", :softlayer_default_datacenter=>nil, :softlayer_default_domain=>nil} /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/compute.rb:62:in new' /home/ethan/.rvm/gems/ruby-2.1.2/gems/knife-softlayer-0.3.2/lib/chef/knife/softlayer_base.rb:63:incompute' /home/ethan/.rvm/gems/ruby-2.1.2/gems/knife-softlayer-0.3.2/lib/chef/knife/softlayer_base.rb:59:in connection' /home/ethan/.rvm/gems/ruby-2.1.2/gems/knife-softlayer-0.3.2/lib/chef/knife/softlayer_server_create.rb:291:inrun' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/lib/chef/knife.rb:492:in run_with_pretty_exceptions' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/lib/chef/knife.rb:174:inrun' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/lib/chef/application/knife.rb:135:in run' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/bin/knife:25:in<top (required)>' /home/ethan/.rvm/gems/ruby-2.1.2/bin/knife:23:in load' /home/ethan/.rvm/gems/ruby-2.1.2/bin/knife:23:in

' /home/ethan/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in eval' /home/ethan/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in
'

The second looks odd, note how the config is an empty hash. {} /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/network.rb:17:in new' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/network.rb:5:in[]' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-softlayer-0.3.15/lib/fog/softlayer/models/compute/server.rb:156:in private_vlan=' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/core/attributes.rb:113:inblock in merge_attributes' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/core/attributes.rb:108:in each' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/core/attributes.rb:108:inmerge_attributes' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/core/model.rb:21:in initialize' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-softlayer-0.3.15/lib/fog/softlayer/models/compute/server.rb:52:ininitialize' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/core/collection.rb:114:in new' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/core/collection.rb:114:innew' /home/ethan/.rvm/gems/ruby-2.1.2/gems/fog-core-1.24.0/lib/fog/core/collection.rb:50:in create' /home/ethan/.rvm/gems/ruby-2.1.2/gems/knife-softlayer-0.3.2/lib/chef/knife/softlayer_server_create.rb:291:inrun' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/lib/chef/knife.rb:492:in run_with_pretty_exceptions' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/lib/chef/knife.rb:174:inrun' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/lib/chef/application/knife.rb:135:in run' /home/ethan/.rvm/gems/ruby-2.1.2/gems/chef-11.12.8/bin/knife:25:in<top (required)>' /home/ethan/.rvm/gems/ruby-2.1.2/bin/knife:23:in load' /home/ethan/.rvm/gems/ruby-2.1.2/bin/knife:23:in

' /home/ethan/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in eval' /home/ethan/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in
'

cphrmky commented 10 years ago

It looks like, while trying to determine what vlan's to use, the fog network components are trying to log into softlayer.

Right, it has to since it's pulling VLANs that are available to your specific account. It seems like it's not properly passing the credentials. I'll spawn a fresh VM and install knife-softlayer only and start from there to debug it on my side, hopefully that will allow me to reproduce.

Presumably I never caught this because 1): I need better testing and 2) my dev environment had ~/.fog configured already and I didn't realize that was hiding this bug.