Skip to content

Commit

Permalink
[COOK-3776] - Specify user to use in ngix::source
Browse files Browse the repository at this point in the history
Signed-off-by: Sean OMeara <[email protected]>
  • Loading branch information
kliuchnikau authored and Sean OMeara committed Nov 4, 2013
1 parent f2c81ab commit ffbf353
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ for default values.
dynamically generated from the
`node['nginx']['source']['default_configure_flags']` in the
`nginx::source` recipe.
* `node['nginx']['source']['use_existing_user']` - set to `true` if you
do not want `nginx::source` recipe to create system user with name
`node['nginx']['user']`.

### geoip
These attributes are used in the `nginx::http_geoip_module` recipe.
Expand Down Expand Up @@ -304,9 +307,11 @@ This recipe is responsible for building Nginx from source. It ensures
that the required packages to build Nginx are installed (pcre,
openssl, compile tools). The source will be downloaded from the
`node['nginx']['source']['url']`. The `node['nginx']['user']` will be
created as a system user. The appropriate configuration and log
directories and config files will be created as well according to the
attributes `node['nginx']['dir']` and 'node['nginx']['log_dir']`.
created as a system user. If you want to use existing user set
`node['nginx']['source']['use_existing_user']` to `true`. The appropriate
configuration and log directories and config files will be created
as well according to the attributes `node['nginx']['dir']` and
`node['nginx']['log_dir']`.

The recipe attempts to detect whether additional modules should be
added to the configure command through recipe inclusion (see below),
Expand Down
1 change: 1 addition & 0 deletions attributes/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@
nginx::http_ssl_module
nginx::http_gzip_static_module
]
default['nginx']['source']['use_existing_user'] = false
10 changes: 6 additions & 4 deletions recipes/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
node.set['nginx']['binary'] = node['nginx']['source']['sbin_path']
node.set['nginx']['daemon_disable'] = true

user node['nginx']['user'] do
system true
shell '/bin/false'
home '/var/www'
unless node['nginx']['source']['use_existing_user']
user node['nginx']['user'] do
system true
shell '/bin/false'
home '/var/www'
end
end

include_recipe 'nginx::ohai_plugin'
Expand Down

0 comments on commit ffbf353

Please sign in to comment.