sous-chefs / nginx

Development repository for the nginx cookbook
https://supermarket.chef.io/cookbooks/nginx
Apache License 2.0
553 stars 806 forks source link

Version picked from public cookbook #462

Closed trueCii closed 6 years ago

trueCii commented 6 years ago

Cookbook version

8.1.5

Chef-client version

Chef: 13.4.19

Platform Details

CentOS Linux release 7.3.1611 (Core) Test Kitchen version 1.17.0 Cloud: Openstack

Scenario:

default['nginx']['source']['prefix'] is using the nginx version from public cookbook

Steps to Reproduce:

wrapper cookbook/attributes/default.rb

default['nginx']['version'] = '1.15.1'
default['nginx']['source']['version'] = '1.15.1'
default['nginx']['install_method'] = 'source'
default['nginx']['source']['url'] = "http://someurl#{node['nginx']['version']}/nginx-#{node['nginx']['version']}.tar.gz"
default['nginx']['source']['checksum'] = 'c7206858d7f832b8ef73a45c9b8f8e436bcb1ee88db2bc85b8e438ecec9d5460'

wrapper cookbook/recipes/default.rb include_recipe 'nginx::default'

Expected Result:

Nginx should be prefixed at /opt/nginx-1.15.1/sbin/nginx

Actual Result:

find . -iname nginx
./etc/nginx
./tmp/kitchen/cache/cookbooks/nginx
./tmp/kitchen/cache/nginx-1.15.1/objs/nginx
./tmp/kitchen/cookbooks/nginx
./var/log/nginx
./opt/nginx-1.12.1/sbin/nginx
which nginx
/opt/nginx-1.12.1/sbin/nginx
cat /lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
ExecStartPre=/opt/nginx-1.12.1/sbin/nginx -t
ExecStart=/opt/nginx-1.12.1/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
/opt/nginx-1.12.1/sbin/nginx -v
nginx version: nginx/1.15.1
welcomebot commented 6 years ago

Hey There It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you. Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.

If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.

trueCii commented 6 years ago

😅 Attribute precendence. Had to override default_configure_flags attribute in wrapper cookbook to get it to work

default['nginx']['version'] = '1.15.1'
default['nginx']['source']['version'] = '1.15.1'
default['nginx']['install_method'] = 'source'
default['nginx']['source']['url'] = "http://someurl#{node['nginx']['version']}/nginx-#{node['nginx']['version']}.tar.gz"
default['nginx']['source']['checksum'] = 'c7206858d7f832b8ef73a45c9b8f8e436bcb1ee88db2bc85b8e438ecec9d5460'

default['nginx']['source']['prefix']    = "/opt/nginx-#{node['nginx']['version']}"
default['nginx']['source']['conf_path'] = "#{node['nginx']['dir']}/nginx.conf"
default['nginx']['source']['sbin_path'] = "#{node['nginx']['source']['prefix']}/sbin/nginx"
default['nginx']['user']           = 'nginx'
default['nginx']['group']          = 'nginx'
default['nginx']['binary']       = '/usr/sbin/nginx'

default['nginx']['source']['default_configure_flags'] = %W{
  --prefix=#{node['nginx']['source']['prefix']}
  --conf-path=#{node['nginx']['source']['conf_path']}
  --sbin-path=#{node['nginx']['source']['sbin_path']}
  --user=#{node['nginx']['user']}
  --group=#{node['nginx']['group']}
}
lock[bot] commented 4 years ago

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.