From 9d652db90ea321739fc2e3a54a31d1bdda6c9787 Mon Sep 17 00:00:00 2001 From: Dmitriy Martynov Date: Tue, 29 Sep 2015 16:51:15 -0400 Subject: [PATCH 1/2] Adding uid and gid overrides --- attributes/default.rb | 4 +++- recipes/default.rb | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 97452cc..d222e3f 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -17,7 +17,9 @@ # limitations under the License. # default['jetty']['user'] = 'jetty' +default['jetty']['uid'] = nil # Default behaviour is to allow the system to pick the UID dynamically default['jetty']['group'] = 'jetty' +default['jetty']['gid'] = nil # Default behaviour is to allow the system to pick the GID dynamically default['jetty']['home'] = '/usr/share/jetty' default['jetty']['port'] = 8080 # The default arguments to pass to jetty. @@ -48,4 +50,4 @@ default['jetty']['syslog']['tag'] = '' default['jetty']['start_ini']['custom'] = false -default['jetty']['start_ini']['content'] = [] \ No newline at end of file +default['jetty']['start_ini']['content'] = [] diff --git a/recipes/default.rb b/recipes/default.rb index 8e128f0..4c1127f 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -50,12 +50,18 @@ home node['jetty']['home'] shell '/bin/false' system true + unless node['jetty']['uid'].nil? + uid node['jetty']['uid'] + end action :create end group node['jetty']['group'] do members node['jetty']['user'] system true + unless node['jetty']['gid'].nil? + gid node['jetty']['gid'] + end action :create end From ac1ce4fd1c8710b91e99fc972b6f00380849f3a7 Mon Sep 17 00:00:00 2001 From: Dmitriy Martynov Date: Tue, 29 Sep 2015 17:02:57 -0400 Subject: [PATCH 2/2] Updating documentation for the new attributes --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 11cb0cf..64748b0 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,9 @@ For more usage examples, have a look to the recipes in test/cookbooks/hipsnip-je ## Attributes * `node["jetty"]["user"]` - name of the jetty user, default "jetty". +* `node["jetty"]["uid"]` - Numeric UID of the jetty user, default is to be dynamically allocated by the system. * `node["jetty"]["group"]` - name of the jetty group, default "jetty". +* `node["jetty"]["gid"]` - Numeric GID of the jetty group, default is to be dynamically allocated by the system. * `node["jetty"]["home"]` - location of the home directory of jetty, default "/usr/share/jetty". * `node["jetty"]["port"]` - port number of where jetty listens, default 8080 * `node["jetty"]["args"]` - arguments pass to jetty at startup , default [], e.g: ["jetty.logs=/var/log/jetty"]. @@ -94,4 +96,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file +limitations under the License.