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

Make node handle NameError from host_inventory #71

Merged
merged 1 commit into from
Jan 29, 2015
Merged

Make node handle NameError from host_inventory #71

merged 1 commit into from
Jan 29, 2015

Conversation

nownabe
Copy link
Contributor

@nownabe nownabe commented Jan 29, 2015

I found two errors of node.

First one is as follows.
It is found with node["undefined"]:

/Users/nownabe/itamae-test/vendor/bundle/ruby/2.2.0/gems/specinfra-2.12.1/lib/specinfra/host_inventory.rb:22:in `const_get': uninitialized constant Undefined (NameError)
    from /Users/nownabe/itamae-test/vendor/bundle/ruby/2.2.0/gems/specinfra-2.12.1/lib/specinfra/host_inventory.rb:22:in `[]'
    from /Users/nownabe/itamae-test/vendor/bundle/ruby/2.2.0/gems/itamae-1.1.3/lib/itamae/node.rb:19:in `[]'
    from /Users/nownabe/itamae-test/recipe.rb:1:in `initialize'

Second one is as follows.
It is found with node["un-defined"]:

/Users/nownabe/itamae-test/vendor/bundle/ruby/2.2.0/gems/specinfra-2.12.1/lib/specinfra/host_inventory.rb:22:in `const_get': wrong constant name Un-defined (NameError)
    from /Users/nownabe/itamae-test/vendor/bundle/ruby/2.2.0/gems/specinfra-2.12.1/lib/specinfra/host_inventory.rb:22:in `[]'
    from /Users/nownabe/itamae-test/vendor/bundle/ruby/2.2.0/gems/itamae-1.1.3/lib/itamae/node.rb:19:in `[]'
    from /Users/nownabe/itamae-test/recipe.rb:1:in `initialize'

@ryotarai
Copy link
Member

Thank you for your contribution!
I also think #[] with unset key should return nil and I'll merge this.

@mizzy I think Specinfra's HostInventry#[] should return nil instead of raising NameError or NotImplementedError when the key is not found, like Hash#[]. How about you?

ryotarai added a commit that referenced this pull request Jan 29, 2015
Make `node` handle NameError from host_inventory
@ryotarai ryotarai merged commit 8ffb78a into itamae-kitchen:master Jan 29, 2015
@ryotarai
Copy link
Member

This is released in v1.1.4.

@mizzy
Copy link
Member

mizzy commented Jan 29, 2015

@mizzy I think Specinfra's HostInventry#[] should return nil instead of raising NameError or NotImplementedError when the key is not found, like Hash#[]. How about you?

You're right. I will fix it later. Thanks!

@nownabe nownabe deleted the hotfix/handle_host_inventory_error branch January 29, 2015 06:04
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

Successfully merging this pull request may close these issues.

3 participants