nginx_status settings not working
Nobody has claimed this yet.
- Dominant language
- Erlang
- Stars
- 303
- Forks
- 211
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 5
Description
I followed the instructions here https://github.com/chef/chef-server/blob/12.3.0/RELEASE_NOTES.md#nginx and got the following error when reconfiguring:
$ sudo chef-server-ctl reconfigure
Starting Chef Client, version 12.5.1
resolving cookbooks for run list: ["private-chef::default"]
Synchronizing Cookbooks:
- private-chef (0.1.0)
- yum (3.6.1)
- enterprise (0.5.1)
- apt (2.7.0)
- runit (1.6.0)
- openssl (4.4.0)
- chef-sugar (3.1.1)
- packagecloud (0.0.18)
Compiling Cookbooks...
Recipe: private-chef::default
* directory[/etc/opscode] action create (up to date)
* directory[/etc/opscode/logrotate.d] action create (up to date)
================================================================================
Recipe Compile Error in /opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/recipes/default.rb
================================================================================
RuntimeError
------------
Error loading file: /etc/opscode/chef-server.rb:52:in `from_file': undefined method `[]=' for nil:NilClass
Cookbook Trace:
---------------
/opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/libraries/private_chef.rb:111:in `rescue in from_file'
/opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/libraries/private_chef.rb:108:in `from_file'
/opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/recipes/config.rb:75:in `from_file'
/opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/recipes/default.rb:38:in `from_file'
Relevant File Content:
----------------------
/opt/opscode/embedded/cookbooks/cache/cookbooks/private-chef/libraries/private_chef.rb:
104: # the reconfigure chef run; we don't particularly care what line in the chef
105: # recipes is failing to evaluate the loaded file (in the case of what
106: # originally triggered this, private_chef.rb), what we care about is which
107: # line in the loaded file is causing the error.
108: begin
109: self.instance_eval(IO.read(filename), filename, 1)
110: rescue
111>> raise "Error loading file: #{$!.backtrace[0]}: #{$!.message}"
112: end
113: end
114:
115: def import_legacy_service_config(old_service_key, new_service_key, keys)
116: keys.each do |configkey|
117: if PrivateChef[old_service_key].has_key? configkey
118: PrivateChef[new_service_key][configkey] ||= PrivateChef[old_service_key][configkey]
119: PrivateChef[old_service_key].delete configkey
120: end
Running handlers:
[2015-11-19T22:36:33+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-11-19T22:36:33+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 03 seconds
[2015-11-19T22:36:33+00:00] FATAL: Stacktrace dumped to /opt/opscode/embedded/cookbooks/cache/chef-stacktrace.out
[2015-11-19T22:36:33+00:00] FATAL: RuntimeError: Error loading file: /etc/opscode/chef-server.rb:52:in `from_file': undefined method `[]=' for nil:NilClass
$
The chef-server.rb file has the following snippet with line number prepended to the line:
51 nginx['enable_stub_status'] = true
52 nginx['stub_status']['listen_host'] = "127.0.0.1"
53 nginx['stub_status']['listen_port'] = "9999"
54 nginx['stub_status']['location'] = "/nginx_status"
What gives? If I add nginx['stub_status'] = {} before line 52 I can reconfigure fine. But when I browse to https://my_awesome_chef_server_url:9999/nginx_status I get a 404.
I've also tried to reconfigure opscode-manage-ctl and to restart both chef-server-ctl and opscode-manage-ctl.
What gives?
Also, why are these attributes not documented here: https://docs.chef.io/config_rb_server.html ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RELEASE_NOTES.md#nginx, the config_rb_server documentation, and the nginx settings in /etc/opscode/chef-server.rb. Trace how private_chef.rb loads that configuration and how the nginx_status attributes are consumed, then verify the fix with chef-server-ctl reconfigure and the /nginx_status endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100