Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no implicit conversion of nil into String on knife google server create #61

Closed
ChadScott opened this issue Mar 27, 2015 · 18 comments
Closed

Comments

@ChadScott
Copy link

I've whacked at this issue for a couple hours now and I can't make sense of it. I'm guessing Google is returning a nil and we're trying to print it.

knife google server create -VV -I centos-6-v20150309 -m f1-micro -Z us-central1-c f7c827-test
INFO: Using configuration from /Users/cscott/knife.rb
Looking for Image 'centos-6-v20150309' in Project 'dulcet-order-87921'
Looking for Image 'centos-6-v20150309' in Project 'centos-cloud'
Found Image 'centos-6-v20150309' in Project 'centos-cloud'
Waiting for the disk insert operation to complete
/opt/chefdk/embedded/lib/ruby/2.1.0/time.rb:325:in `_parse': no implicit conversion of nil into String (TypeError)
    from /opt/chefdk/embedded/lib/ruby/2.1.0/time.rb:325:in `parse'
    from /Users/cscott/.chefdk/gem/ruby/2.1.0/gems/knife-google-1.3.1/lib/google/compute/zone_operation.rb:42:in `from_hash'
    from /Users/cscott/.chefdk/gem/ruby/2.1.0/gems/knife-google-1.3.1/lib/google/compute/resource.rb:28:in `initialize'
    from /Users/cscott/.chefdk/gem/ruby/2.1.0/gems/knife-google-1.3.1/lib/google/compute/creatable_resource_collection.rb:35:in `new'
    from /Users/cscott/.chefdk/gem/ruby/2.1.0/gems/knife-google-1.3.1/lib/google/compute/creatable_resource_collection.rb:35:in `create'
    from /Users/cscott/.chefdk/gem/ruby/2.1.0/gems/knife-google-1.3.1/lib/google/compute/creatable_resource_collection.rb:45:in `insert'
    from /Users/cscott/.chefdk/gem/ruby/2.1.0/gems/knife-google-1.3.1/lib/chef/knife/google_server_create.rb:427:in `run'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:417:in `block in run_with_pretty_exceptions'
    from /opt/chefdk/embedded/apps/chef/lib/chef/local_mode.rb:38:in `with_server_connectivity'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:416:in `run_with_pretty_exceptions'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:213:in `run'
    from /opt/chefdk/embedded/apps/chef/lib/chef/application/knife.rb:139:in `run'
    from /opt/chefdk/embedded/apps/chef/bin/knife:25:in `<top (required)>'
    from /usr/bin/knife:40:in `load'
    from /usr/bin/knife:40:in `<main>'
@ChadScott
Copy link
Author

I've noticed that knife google server create successfully creates the disk, as I see it in the console, but apparently bombs out somewhere between that and launching the VM itself.

@ChadScott
Copy link
Author

@start_time = Time.parse( data["startTime"] ) appears to be the culprit but I haven't had time to dig deeper. I'm guessing data["startTime"] is nil.

@paulrossman
Copy link
Contributor

Thanks for digging into this. I'll make some time on Monday to take a look
too.

On Fri, Mar 27, 2015, 15:27 ChadScott notifications@github.com wrote:

@start_time = Time.parse( data["startTime"] ) appears to be the culprit
but I haven't had time to dig deeper. I'm guessing data["startTime"] is
nil.


Reply to this email directly or view it on GitHub
#61 (comment).

@ChadScott
Copy link
Author

Alright, I'm at a loss. I've dug on this for a little bit and I don't know enough about the GCE API nor the internals of Knife to really be able to get to the bottom of it without going into a cave for awhile. Any luck on your end, @paulrossman?

@ChadScott
Copy link
Author

If it helps, here are the versions of the Google related gems:

google-api (0.4.0)
google-api-client (0.7.1)
googleauth (0.4.0)
knife-google (1.3.1)

@paulrossman
Copy link
Contributor

Sorry for the late reply. I've not run in to this issue at all and have been building lots of instances recently.

My suggestion is to update to knife-google 1.4.x. There were a bunch of gemspec changes in #54. I currently have these gem versions installed:

chef (12.2.1)
google-api-client (0.8.5)
googleauth (0.4.0)
knife-google (1.4.3 5a4ccf4)

@ChadScott
Copy link
Author

After upgrading to knife-google 1.4.3 (which isn't in the gem repo, by the way... I had to pull it down from Github and manually install it), I get yet another error:

knife google zone list
ERROR: Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I thought at first it must be something in my SSL stack, but it works fine for ec2:

knife ec2 flavor list --aws-credential-file .boto
ID                                       Name                                     Architecture                             RAM                                      Disk  Cores
c1.medium                                High-CPU Medium                          32-bit                                   1740.8                                   350 GB                                   5

...etc

@ChadScott
Copy link
Author

Okay, I finally figured this out. For those that find this via googling or whatever, this is a problem with chefdk on MacOS. I'm unsure exactly what the issue is, but this solves it for me:

Install brew (brew.sh)
brew install ruby
gem install chef
::download knife-google from this repo::
rake
gem install pkg/knife-google-1.4.3.gem
knife google zone list

Voila!

@jameshcoppens
Copy link

I am still getting this error as well. I'm not really interested in building my own gem. I'll see if I can resolve for knife-google 1.3.1

@jameshcoppens
Copy link

So, I figured out the issue with a small code change.

Chad, you were absolutely right. The code line

@start_time = Time.parse( data["startTime"] )

was the culprit.

The reason why when you build the 1.4.3 gem it works is in that version there is a null check on the variable. I think that the new gem version should be built and distributed. I simply changed the following lines in my lib/google/compute/zone_operation.rb file

@insert_time = Time.parse( data["insertTime"] ) if data.key?("insertTime")
@start_time = Time.parse( data["startTime"] ) if data.key?("startTime")

@ohadperry
Copy link

I have tried that in both global_operation.rb and zone_operation.rb and it doesn't seem to work.
Is there a way to run this with a stack trace?
tried:
knife google --verbose zone list

@ohadperry
Copy link

Is there another gem that does that?

@jameshcoppens
Copy link

ohadpartuck,

I've used -VV on the end of the string. Can you output what you see when you run the command. This plugin is really important especially if you are negotiating with Amazon about your monthly AWS bill.

knige google zone list -VV

@ohadperry
Copy link

@jeremiahsnapp ok , that helped , After 15 mins, I tracked the issue to
signet-0.7.0/lib/signet/oauth_2/client.rb:1182 -> normalize_timestamp
it reading "2015-12-16 17:20:39 +0200" from my oauth file .google-compute.json
and doing
Time.parse("2015-12-16 17:20:39 +0200")
It failed for no implicit conversion of Time into String (TypeError)

weirdly, I ran it in the console and it works:

2.1.5 :005 > Time.parse("2015-12-16 17:20:39 +0200")
 => 2015-12-16 17:20:39 +0200

Now that I see that, it's not the same error as stated in this log.

any ideas?

@ohadperry
Copy link

@sqrrrl maybe you can take a look?

@sqrrrl
Copy link

sqrrrl commented Dec 17, 2015

Argh. Yes, there was a stupid bug introduced in 0.7. Just pushed 0.7.1 which should fix the issue.

@ohadpartuck - Please update and let me know if it addresses the issue you're seeing.

@ohadperry
Copy link

@sqrrrl I don't see 0.7.1 neither here
https://rubygems.org/gems/signet/versions/0.7.0
or here
https://github.com/google/signet/releases
can you send a link

@ohadperry
Copy link

nvm , found it here
https://rubygems.org/gems/signet/versions/0.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants