Skip to content
New issue

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

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

Already on GitHub? # to your account

Crash on first install when using nginx::source #13

Closed
wants to merge 14 commits into from
Closed

Crash on first install when using nginx::source #13

wants to merge 14 commits into from

Conversation

cjoudrey
Copy link

When installing nginx from source using nginx::source, recipe crashes on first install because node.automatic_attrs['nginx'] is nil.


Trace

[2012-06-16T13:27:51-04:00] ERROR: Running exception handlers
[2012-06-16T13:27:51-04:00] ERROR: Exception handlers complete
[2012-06-16T13:27:51-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2012-06-16T13:27:51-04:00] FATAL: NoMethodError: bash[compile_nginx_source] (nginx::source line 79) had an error: NoMethodError: undefined method `[]' for nil:NilClass

@mrrooijen
Copy link

+1 i also keep getting this error.

@kesor
Copy link

kesor commented Jul 3, 2012

In addition to this -- I think node['nginx']['version'] should not be the attribute being set in a role to define which version to build. Since that attribute is already used by ohai and there is a name collision and a whole lot of problems. I'll create a patch that makes a separate version attribute to define which source version to build.

nginx['version'] is ohai attribute that is empty before nginx is installed.
Installing a specific source version now has its own attribute that does
not collide with the ohai attribute.
@kiesia
Copy link

kiesia commented Jul 6, 2012

Please do, this has been driving me a bit crazy for the last hour!

@kesor
Copy link

kesor commented Jul 6, 2012

@kiesia you can merge #14 to fix the version problem.

@kiesia
Copy link

kiesia commented Jul 8, 2012

@kesor thanks for that

@dfuentes77
Copy link

cjoudrey's quick solution worked for me.

@nickpresta
Copy link

Actually, I get the same error on a CentOS 6.0 virtualmachine. Compiling other things from source works fine (node, mysql, etc).

I've applied both the @cjoudrey fix and the @kesor fix and neither worked.

[2012-07-25T15:06:34-04:00] INFO: *** Chef 10.12.0 ***
[2012-07-25T15:06:34-04:00] INFO: Setting the run_list to ["recipe[nginx::source]"] from JSON
[2012-07-25T15:06:34-04:00] INFO: Run List is [recipe[nginx::source]]
[2012-07-25T15:06:34-04:00] INFO: Run List expands to [nginx::source]
[2012-07-25T15:06:34-04:00] INFO: Starting Chef Run for localhost.localdomain.lan
[2012-07-25T15:06:34-04:00] INFO: Running start handlers
[2012-07-25T15:06:34-04:00] INFO: Start handlers complete.
[2012-07-25T15:06:35-04:00] ERROR: Running exception handlers
[2012-07-25T15:06:35-04:00] ERROR: Exception handlers complete
[2012-07-25T15:06:35-04:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2012-07-25T15:06:35-04:00] FATAL: NoMethodError: undefined method `[]' for nil:NilClass
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

The same happens when I change the recipe to simply nginx (non-source).

@dfuentes77
Copy link

After continual testing, I find that it completes the first chef-client run correctly but when launching a new node using an AMI that already has Nginx compiled and installed from that recipe, it re-compiles and installs it anyway because the attributes aren't matching. This check should probably be more generic and compare expected version and configure flags against the output of actually running something like "nginx -V"

@RKushnir
Copy link

RKushnir commented Feb 6, 2013

So is nginx::source usable?
I get undefined method [] for nil:NilClass for the line nginx/recipes/source.rb:25:

 25>> nginx_url = node['nginx']['source']['url'] ||
 26:    "http://nginx.org/download/nginx-#{node['nginx']['version']}.tar.gz"

Do I have to set anything in the node file? Even if I specify all of the nested hashes used in this line, node['nginx'] is still nil.

@RKushnir
Copy link

RKushnir commented Feb 7, 2013

Ah, it's not compatible with Chef 11. After downgrading to 10 it just works.

@dfuentes77
Copy link

Yeah, there are going to be a lot of items like that in the cookbooks. That's why I'll be waiting awhile before going to 11.

@pierreozoux
Copy link

@RKushnir and @dfuentes77 : I filled a bug here : http://tickets.opscode.com/browse/COOK-2417 if you know how to fix it? I'll work on it this morning.

@RKushnir
Copy link

@pierreozoux Unfortunately, I'm a newbie in chef so can't help at all. Thanks for taking this over.

@pierreozoux
Copy link

@RKushnir : do you call nginx::source from another recipe? I updated the ticket : http://tickets.opscode.com/browse/CHEF-3893

@RKushnir
Copy link

@pierreozoux Yes, I get this error when including this recipe from another recipe. However, when I call it directly it also gives an error in another line.

@jtimberman
Copy link

I'm sorry that no one from Opscode has responded to this pull request in the several months since it was opened and discussed here. Due to time constraints, we usually only review pull requests that are associated to a "Fix Provided" COOK ticket, and this doesn't have a specific ticket linked. Later commits mention several tickets, which have all been closed as they're released in versions published to the community site.

I used the nginx::source recipe on an Ubuntu 12.04 node with Chef 11.4.0 w/o issue:

Note that "apt" is required in order to ensure that the package cache is updated. "runit" is required on the node's run list because the nginx cookbook doesn't have a hard dependency on it.

Subsequent chef-client runs had no exceptions/problems. I'm using the master branch, which is v1.3.0.

I'm closing this pull request as the source recipe is working as intended. If you're experiencing other problems, please open a ticket in the COOK project, using 'nginx' as the component at:

Thank you!

@jtimberman jtimberman closed this Feb 18, 2013
aried3r pushed a commit to NR-Systems/nginx that referenced this pull request Aug 25, 2016
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants