Skip to content

Commit 9b340c4

Browse files
committed
Adding a feature for setting the owner of a created file
1 parent 0b79141 commit 9b340c4

4 files changed

Lines changed: 30 additions & 4 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Cookbook Name:: files
3+
# Recipe:: default
4+
#
5+
# Copyright 2009, Opscode
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
file "#{node[:tmpdir]}/create_a_file.txt" do
21+
owner 'nobody'
22+
action :create
23+
end

features/manage_files.feature

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ Feature: Manage Files
1515
And it includes the recipe 'manage_files::set_the_owner_of_a_created_file'
1616
When I run the chef-client
1717
Then the run should exit '0'
18-
And a file named 'create_a_file.txt' should exist
19-
20-
18+
And the file named 'create_a_file.txt' should be owned by 'nobody'
19+
2120
Scenario: Delete a file
2221
Given a validated node
2322
And it includes the recipe 'manage_files::delete_a_file'

features/steps/cookbooks.rb

Lines changed: 0 additions & 1 deletion
This file was deleted.

features/steps/files.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@
5252
current_atime.should_not == @atime
5353
end
5454
end
55+
56+
Then /^the file named '(.+)' should be owned by '(.+)'$/ do |filename, owner|
57+
58+
end
59+

0 commit comments

Comments
 (0)