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

undefined method `[]' for nil:NilClass in attributes/default.rb #8

Closed
craigmonson opened this issue May 29, 2014 · 5 comments · Fixed by #9
Closed

undefined method `[]' for nil:NilClass in attributes/default.rb #8

craigmonson opened this issue May 29, 2014 · 5 comments · Fixed by #9
Assignees

Comments

@craigmonson
Copy link

Hey there! I'm getting an error when I run this guy:

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cookbooks/krb5/attributes/default.rb:

    56:  default['krb5']['ticket_lifetime'] = '24h'
    57:  default['krb5']['renew_lifetime'] = '24h'
    58:  default['krb5']['forwardable'] = 'true'
    59:  
    60:  default_realm =
    61:    if node['krb5']['default_realm']
    62:      node['krb5']['default_realm'].upcase
    63>>   elsif node['krb5']['krb5_conf']['libdefaults']['default_realm']
    64:      ['krb5']['krb5_conf']['libdefaults']['default_realm'].upcase
    65:    else
    66:      'LOCAL'
    67:    end
    68:  
    69:  # Client Packages
    70:  default['krb5']['client']['packages'] = node['krb5']['packages']
    71:  default['krb5']['client']['authconfig'] = node['krb5']['authconfig']
    72:  

node['krb5']['krb5_conf'] isn't autovivified till after this appears. (unless I'm missing something). Also, I believe that the line following the error is missing a 'node' in front of the hash brackets.

Beyond that, I can't get it to run unless I comment out the entire if else block and just assign default_realm = 'LOCAL'. I don't think you can call node this way since node hasn't been defined until after these attributes are setup? I'm wrapping this and including the recipe, so maybe it's that?

@atomic-penguin
Copy link
Owner

pinging @wolf31o2

@wolf31o2 wolf31o2 self-assigned this May 30, 2014
@wolf31o2
Copy link
Collaborator

I'll take a look at it as soon as I get a chance.

wolf31o2 added a commit that referenced this issue May 30, 2014
@wolf31o2 wolf31o2 mentioned this issue May 30, 2014
@wolf31o2
Copy link
Collaborator

Waiting for Travis CI before I merge this. Everything passed locally, but I prefer external tests.

@wolf31o2
Copy link
Collaborator

Fix released in 1.0.1

@craigmonson
Copy link
Author

Thanks guys! That was a very quick turnaround :)

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 a pull request may close this issue.

3 participants