chef 0.10.0.beta.6 → 0.10.0.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/application.rb +3 -0
- data/lib/chef/application/client.rb +34 -2
- data/lib/chef/checksum.rb +2 -2
- data/lib/chef/checksum_cache.rb +2 -2
- data/lib/chef/client.rb +7 -5
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook/syntax_check.rb +2 -2
- data/lib/chef/cookbook_version.rb +5 -0
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/environment.rb +31 -9
- data/lib/chef/file_access_control.rb +7 -3
- data/lib/chef/index_queue/indexable.rb +2 -2
- data/lib/chef/knife.rb +1 -1
- data/lib/chef/knife/bootstrap.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +2 -2
- data/lib/chef/knife/cookbook_upload.rb +32 -11
- data/lib/chef/knife/core/subcommand_loader.rb +24 -13
- data/lib/chef/knife/core/text_formatter.rb +2 -2
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/search.rb +1 -1
- data/lib/chef/knife/ssh.rb +1 -0
- data/lib/chef/mixin/shell_out.rb +2 -2
- data/lib/chef/node.rb +7 -4
- data/lib/chef/provider/cookbook_file.rb +4 -5
- data/lib/chef/provider/cron.rb +3 -3
- data/lib/chef/provider/cron/solaris.rb +7 -7
- data/lib/chef/provider/deploy.rb +52 -29
- data/lib/chef/provider/directory.rb +8 -8
- data/lib/chef/provider/env.rb +8 -8
- data/lib/chef/provider/erl_call.rb +7 -6
- data/lib/chef/provider/execute.rb +7 -2
- data/lib/chef/provider/file.rb +9 -9
- data/lib/chef/provider/git.rb +17 -8
- data/lib/chef/provider/group.rb +6 -6
- data/lib/chef/provider/group/aix.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +2 -2
- data/lib/chef/provider/group/gpasswd.rb +3 -3
- data/lib/chef/provider/group/groupadd.rb +1 -1
- data/lib/chef/provider/group/pw.rb +3 -3
- data/lib/chef/provider/group/usermod.rb +2 -2
- data/lib/chef/provider/group/windows.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +9 -7
- data/lib/chef/provider/link.rb +27 -24
- data/lib/chef/provider/mdadm.rb +10 -10
- data/lib/chef/provider/mount.rb +10 -13
- data/lib/chef/provider/mount/mount.rb +10 -10
- data/lib/chef/provider/mount/windows.rb +4 -3
- data/lib/chef/provider/ohai.rb +2 -1
- data/lib/chef/provider/package.rb +10 -6
- data/lib/chef/provider/package/apt.rb +18 -18
- data/lib/chef/provider/package/dpkg.rb +3 -3
- data/lib/chef/provider/package/easy_install.rb +2 -2
- data/lib/chef/provider/package/freebsd.rb +4 -5
- data/lib/chef/provider/package/macports.rb +2 -2
- data/lib/chef/provider/package/pacman.rb +2 -2
- data/lib/chef/provider/package/portage.rb +1 -1
- data/lib/chef/provider/package/rpm.rb +3 -3
- data/lib/chef/provider/package/rubygems.rb +7 -7
- data/lib/chef/provider/package/solaris.rb +9 -9
- data/lib/chef/provider/package/yum.rb +4 -4
- data/lib/chef/provider/package/zypper.rb +5 -11
- data/lib/chef/provider/remote_directory.rb +15 -14
- data/lib/chef/provider/remote_file.rb +11 -12
- data/lib/chef/provider/route.rb +8 -10
- data/lib/chef/provider/ruby_block.rb +1 -0
- data/lib/chef/provider/service.rb +10 -16
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/freebsd.rb +16 -18
- data/lib/chef/provider/service/gentoo.rb +2 -3
- data/lib/chef/provider/service/simple.rb +7 -5
- data/lib/chef/provider/service/upstart.rb +8 -8
- data/lib/chef/provider/service/windows.rb +3 -3
- data/lib/chef/provider/subversion.rb +12 -9
- data/lib/chef/provider/template.rb +2 -3
- data/lib/chef/provider/user.rb +13 -14
- data/lib/chef/provider/user/dscl.rb +2 -2
- data/lib/chef/provider/user/pw.rb +4 -4
- data/lib/chef/provider/user/useradd.rb +3 -3
- data/lib/chef/provider/user/windows.rb +3 -3
- data/lib/chef/resource.rb +4 -3
- data/lib/chef/resource/deploy.rb +1 -1
- data/lib/chef/rest/rest_request.rb +2 -2
- data/lib/chef/run_context.rb +1 -1
- data/lib/chef/shell_out.rb +13 -1
- data/lib/chef/solr_query.rb +1 -1
- data/lib/chef/solr_query/solr_http_request.rb +1 -1
- data/lib/chef/tasks/chef_repo.rake +74 -0
- data/lib/chef/version.rb +1 -1
- metadata +2 -2
@@ -6,9 +6,9 @@
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -36,31 +36,31 @@ class Chef
|
|
36
36
|
@current_resource.mode("%o" % (cstats.mode & 007777))
|
37
37
|
end
|
38
38
|
@current_resource
|
39
|
-
end
|
40
|
-
|
39
|
+
end
|
40
|
+
|
41
41
|
def action_create
|
42
42
|
unless ::File.exists?(@new_resource.path)
|
43
|
-
Chef::Log.info("Creating #{@new_resource} at #{@new_resource.path}")
|
44
43
|
if @new_resource.recursive == true
|
45
44
|
::FileUtils.mkdir_p(@new_resource.path)
|
46
45
|
else
|
47
46
|
::Dir.mkdir(@new_resource.path)
|
48
47
|
end
|
49
48
|
@new_resource.updated_by_last_action(true)
|
49
|
+
Chef::Log.info("#{@new_resource} created directory #{@new_resource.path}")
|
50
50
|
end
|
51
51
|
set_owner if @new_resource.owner != nil
|
52
52
|
set_group if @new_resource.group != nil
|
53
53
|
set_mode if @new_resource.mode != nil
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def action_delete
|
57
57
|
if ::File.directory?(@new_resource.path) && ::File.writable?(@new_resource.path)
|
58
58
|
if @new_resource.recursive == true
|
59
|
-
Chef::Log.info("Deleting #{@new_resource} recursively at #{@new_resource.path}")
|
60
59
|
FileUtils.rm_rf(@new_resource.path)
|
60
|
+
Chef::Log.info("#{@new_resource} deleted #{@new_resource.path} recursively")
|
61
61
|
else
|
62
|
-
Chef::Log.info("Deleting #{@new_resource} at #{@new_resource.path}")
|
63
62
|
::Dir.delete(@new_resource.path)
|
63
|
+
Chef::Log.info("#{@new_resource} deleted #{@new_resource.path}")
|
64
64
|
end
|
65
65
|
@new_resource.updated_by_last_action(true)
|
66
66
|
else
|
data/lib/chef/provider/env.rb
CHANGED
@@ -39,14 +39,14 @@ class Chef
|
|
39
39
|
@current_resource.value(env_value(@new_resource.key_name))
|
40
40
|
else
|
41
41
|
@key_exists = false
|
42
|
-
Chef::Log.debug("#{@new_resource}
|
42
|
+
Chef::Log.debug("#{@new_resource} key does not exist")
|
43
43
|
end
|
44
44
|
|
45
45
|
@current_resource
|
46
46
|
end
|
47
47
|
|
48
48
|
def env_value(key_name)
|
49
|
-
raise Chef::Exceptions::Env, "#{
|
49
|
+
raise Chef::Exceptions::Env, "#{self.to_s} provider does not implement env_value!"
|
50
50
|
end
|
51
51
|
|
52
52
|
def env_key_exists(key_name)
|
@@ -73,12 +73,12 @@ class Chef
|
|
73
73
|
if @key_exists
|
74
74
|
if compare_value
|
75
75
|
modify_env
|
76
|
-
Chef::Log.info("
|
76
|
+
Chef::Log.info("#{@new_resource} altered")
|
77
77
|
@new_resource.updated_by_last_action(true)
|
78
78
|
end
|
79
79
|
else
|
80
80
|
create_env
|
81
|
-
Chef::Log.
|
81
|
+
Chef::Log.info("#{@new_resource} created")
|
82
82
|
@new_resource.updated_by_last_action(true)
|
83
83
|
end
|
84
84
|
end
|
@@ -92,7 +92,7 @@ class Chef
|
|
92
92
|
def delete_element
|
93
93
|
return false unless @new_resource.delim #no delim: delete the key
|
94
94
|
if compare_value
|
95
|
-
Chef::Log.debug("#{@new_resource}
|
95
|
+
Chef::Log.debug("#{@new_resource} element '#{@new_resource.value}' does not exist")
|
96
96
|
return true #do not delete the key
|
97
97
|
else
|
98
98
|
new_value =
|
@@ -105,7 +105,7 @@ class Chef
|
|
105
105
|
else
|
106
106
|
old_value = @new_resource.value(new_value)
|
107
107
|
create_env
|
108
|
-
Chef::Log.debug("
|
108
|
+
Chef::Log.debug("#{@new_resource} deleted #{old_value} element")
|
109
109
|
@new_resource.updated_by_last_action(true)
|
110
110
|
return true #we removed the element and updated; do not delete the key
|
111
111
|
end
|
@@ -115,7 +115,7 @@ class Chef
|
|
115
115
|
def action_delete
|
116
116
|
if @key_exists && !delete_element
|
117
117
|
delete_env
|
118
|
-
Chef::Log.
|
118
|
+
Chef::Log.info("#{@new_resource} deleted")
|
119
119
|
@new_resource.updated_by_last_action(true)
|
120
120
|
end
|
121
121
|
end
|
@@ -124,8 +124,8 @@ class Chef
|
|
124
124
|
if @key_exists
|
125
125
|
if compare_value
|
126
126
|
modify_env
|
127
|
+
Chef::Log.info("#{@new_resource} modified")
|
127
128
|
@new_resource.updated_by_last_action(true)
|
128
|
-
Chef::Log.info("Modified #{@new_resource}")
|
129
129
|
end
|
130
130
|
else
|
131
131
|
raise Chef::Exceptions::Env, "Cannot modify #{@new_resource} - key does not exist!"
|
@@ -58,15 +58,15 @@ class Chef
|
|
58
58
|
begin
|
59
59
|
pid, stdin, stdout, stderr = popen4(command, :waitlast => true)
|
60
60
|
|
61
|
-
Chef::Log.debug("
|
62
|
-
Chef::Log.debug("
|
63
|
-
Chef::Log.debug("
|
61
|
+
Chef::Log.debug("#{@new_resource} running")
|
62
|
+
Chef::Log.debug("#{@new_resource} command: #{command}")
|
63
|
+
Chef::Log.debug("#{@new_resource} code: #{@new_resource.code}")
|
64
64
|
|
65
65
|
@new_resource.code.each_line { |line| stdin.puts(line.chomp) }
|
66
66
|
|
67
67
|
stdin.close
|
68
68
|
|
69
|
-
Chef::Log.debug("
|
69
|
+
Chef::Log.debug("#{@new_resource} output: ")
|
70
70
|
|
71
71
|
stdout_output = ""
|
72
72
|
stdout.each_line { |line| stdout_output << line }
|
@@ -86,9 +86,10 @@ class Chef
|
|
86
86
|
raise Chef::Exceptions::ErlCall, stdout_output
|
87
87
|
end
|
88
88
|
|
89
|
-
|
90
|
-
Chef::Log.info("Ran erl_call[#{@new_resource.name}] successfully")
|
89
|
+
@new_resource.updated_by_last_action(true)
|
91
90
|
|
91
|
+
Chef::Log.debug("#{@new_resource} #{stdout_output}")
|
92
|
+
Chef::Log.info("#{@new_resouce} ran successfully")
|
92
93
|
ensure
|
93
94
|
Process.wait(pid) if pid
|
94
95
|
end
|
@@ -35,7 +35,7 @@ class Chef
|
|
35
35
|
|
36
36
|
if sentinel_file = @new_resource.creates
|
37
37
|
if ::File.exists?(sentinel_file)
|
38
|
-
Chef::Log.
|
38
|
+
Chef::Log.debug("#{@new_resource} sentinel file #{sentinel_file} exists - nothing to do")
|
39
39
|
return false
|
40
40
|
end
|
41
41
|
end
|
@@ -49,10 +49,15 @@ class Chef
|
|
49
49
|
opts[:group] = @new_resource.group if @new_resource.group
|
50
50
|
opts[:cwd] = @new_resource.cwd if @new_resource.cwd
|
51
51
|
opts[:umask] = @new_resource.umask if @new_resource.umask
|
52
|
+
opts[:command_log_level] = :info
|
53
|
+
opts[:command_log_prepend] = @new_resource.to_s
|
54
|
+
if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info?
|
55
|
+
opts[:live_stream] = STDOUT
|
56
|
+
end
|
52
57
|
|
53
58
|
result = shell_out!(@new_resource.command, opts)
|
54
59
|
@new_resource.updated_by_last_action(true)
|
55
|
-
Chef::Log.info("
|
60
|
+
Chef::Log.info("#{@new_resource} ran successfully")
|
56
61
|
end
|
57
62
|
|
58
63
|
end
|
data/lib/chef/provider/file.rb
CHANGED
@@ -63,9 +63,9 @@ class Chef
|
|
63
63
|
# Set the content of the file, assuming it is not set correctly already.
|
64
64
|
def set_content
|
65
65
|
unless compare_content
|
66
|
-
Chef::Log.info("Setting content for #{@new_resource}")
|
67
66
|
backup @new_resource.path if ::File.exists?(@new_resource.path)
|
68
67
|
::File.open(@new_resource.path, "w") {|f| f.write @new_resource.content }
|
68
|
+
Chef::Log.info("#{@new_resource} contents updated")
|
69
69
|
@new_resource.updated_by_last_action(true)
|
70
70
|
end
|
71
71
|
end
|
@@ -88,9 +88,9 @@ class Chef
|
|
88
88
|
# Set the ownership on the file, assuming it is not set correctly already.
|
89
89
|
def set_owner
|
90
90
|
unless compare_owner
|
91
|
-
Chef::Log.info("Setting owner to #{@set_user_id} for #{@new_resource}")
|
92
91
|
@set_user_id = negative_complement(@set_user_id)
|
93
92
|
::File.chown(@set_user_id, nil, @new_resource.path)
|
93
|
+
Chef::Log.info("#{@new_resource} owner changed to #{@set_user_id}")
|
94
94
|
@new_resource.updated_by_last_action(true)
|
95
95
|
end
|
96
96
|
end
|
@@ -111,9 +111,9 @@ class Chef
|
|
111
111
|
|
112
112
|
def set_group
|
113
113
|
unless compare_group
|
114
|
-
Chef::Log.info("Setting group to #{@set_group_id} for #{@new_resource}")
|
115
114
|
@set_group_id = negative_complement(@set_group_id)
|
116
115
|
::File.chown(nil, @set_group_id, @new_resource.path)
|
116
|
+
Chef::Log.info("#{@new_resource} group changed to #{@set_group_id}")
|
117
117
|
@new_resource.updated_by_last_action(true)
|
118
118
|
end
|
119
119
|
end
|
@@ -129,9 +129,9 @@ class Chef
|
|
129
129
|
|
130
130
|
def set_mode
|
131
131
|
unless compare_mode && @new_resource.mode != nil
|
132
|
-
Chef::Log.info("Setting mode to #{sprintf("%o" % octal_mode(@new_resource.mode))} for #{@new_resource}")
|
133
132
|
# CHEF-174, bad mojo around treating integers as octal. If a string is passed, we try to do the "right" thing
|
134
133
|
::File.chmod(octal_mode(@new_resource.mode), @new_resource.path)
|
134
|
+
Chef::Log.info("#{@new_resource} mode changed to #{sprintf("%o" % octal_mode(@new_resource.mode))}")
|
135
135
|
@new_resource.updated_by_last_action(true)
|
136
136
|
end
|
137
137
|
end
|
@@ -139,9 +139,9 @@ class Chef
|
|
139
139
|
def action_create
|
140
140
|
assert_enclosing_directory_exists!
|
141
141
|
unless ::File.exists?(@new_resource.path)
|
142
|
-
Chef::Log.info("Creating #{@new_resource} at #{@new_resource.path}")
|
143
142
|
::File.open(@new_resource.path, "w+") {|f| f.write @new_resource.content }
|
144
143
|
@new_resource.updated_by_last_action(true)
|
144
|
+
Chef::Log.info("#{@new_resource} created file #{@new_resource.path}")
|
145
145
|
else
|
146
146
|
set_content unless @new_resource.content.nil?
|
147
147
|
end
|
@@ -158,8 +158,8 @@ class Chef
|
|
158
158
|
if ::File.exists?(@new_resource.path)
|
159
159
|
if ::File.writable?(@new_resource.path)
|
160
160
|
backup unless ::File.symlink?(@new_resource.path)
|
161
|
-
Chef::Log.info("Deleting #{@new_resource} at #{@new_resource.path}")
|
162
161
|
::File.delete(@new_resource.path)
|
162
|
+
Chef::Log.info("#{@new_resource} deleted file at #{@new_resource.path}")
|
163
163
|
@new_resource.updated_by_last_action(true)
|
164
164
|
else
|
165
165
|
raise "Cannot delete #{@new_resource} at #{@new_resource_path}!"
|
@@ -170,8 +170,8 @@ class Chef
|
|
170
170
|
def action_touch
|
171
171
|
action_create
|
172
172
|
time = Time.now
|
173
|
-
Chef::Log.info("Updating #{@new_resource} with new atime/mtime of #{time}")
|
174
173
|
::File.utime(time, time, @new_resource.path)
|
174
|
+
Chef::Log.info("#{@new_resource} updated atime and mtime to #{time}")
|
175
175
|
@new_resource.updated_by_last_action(true)
|
176
176
|
end
|
177
177
|
|
@@ -188,8 +188,8 @@ class Chef
|
|
188
188
|
prefix = Chef::Config[:file_backup_path].to_s
|
189
189
|
backup_path = ::File.join(prefix, backup_filename)
|
190
190
|
FileUtils.mkdir_p(::File.dirname(backup_path)) if Chef::Config[:file_backup_path]
|
191
|
-
Chef::Log.info("Backing up #{@new_resource} to #{backup_path}")
|
192
191
|
FileUtils.cp(file, backup_path, :preserve => true)
|
192
|
+
Chef::Log.info("#{@new_resource} backed up to #{backup_path}")
|
193
193
|
|
194
194
|
# Clean up after the number of backups
|
195
195
|
slice_number = @new_resource.backup
|
@@ -197,8 +197,8 @@ class Chef
|
|
197
197
|
if backup_files.length >= @new_resource.backup
|
198
198
|
remainder = backup_files.slice(slice_number..-1)
|
199
199
|
remainder.each do |backup_to_delete|
|
200
|
-
Chef::Log.info("Removing backup of #{@new_resource} at #{backup_to_delete}")
|
201
200
|
FileUtils.rm(backup_to_delete)
|
201
|
+
Chef::Log.info("#{@new_resource} removed backup at #{backup_to_delete}")
|
202
202
|
end
|
203
203
|
end
|
204
204
|
end
|
data/lib/chef/provider/git.rb
CHANGED
@@ -44,7 +44,7 @@ class Chef
|
|
44
44
|
enable_submodules
|
45
45
|
@new_resource.updated_by_last_action(true)
|
46
46
|
else
|
47
|
-
Chef::Log.
|
47
|
+
Chef::Log.debug "#{@new_resource} checkout destination #{@new_resource.destination} already exists or is a non-empty directory"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -63,7 +63,7 @@ class Chef
|
|
63
63
|
unless current_revision_matches_target_revision?
|
64
64
|
fetch_updates
|
65
65
|
enable_submodules
|
66
|
-
Chef::Log.info "#{@new_resource} updated to revision
|
66
|
+
Chef::Log.info "#{@new_resource} updated to revision #{target_revision}"
|
67
67
|
@new_resource.updated_by_last_action(true)
|
68
68
|
end
|
69
69
|
|
@@ -90,6 +90,7 @@ class Chef
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def find_current_revision
|
93
|
+
Chef::Log.debug("#{@new_resource} finding current git revision")
|
93
94
|
if ::File.exist?(::File.join(cwd, ".git"))
|
94
95
|
# 128 is returned when we're not in a git repo. this is fine
|
95
96
|
result = shell_out!('git rev-parse HEAD', :cwd => cwd, :returns => [0,128]).stdout.strip
|
@@ -104,24 +105,24 @@ class Chef
|
|
104
105
|
args << "-o #{remote}" unless remote == 'origin'
|
105
106
|
args << "--depth #{@new_resource.depth}" if @new_resource.depth
|
106
107
|
|
107
|
-
Chef::Log.info "
|
108
|
+
Chef::Log.info "#{@new_resource} cloning repo #{@new_resource.repository} to #{@new_resource.destination}"
|
108
109
|
|
109
110
|
clone_cmd = "git clone #{args.join(' ')} #{@new_resource.repository} #{@new_resource.destination}"
|
110
|
-
shell_out!(clone_cmd, run_options)
|
111
|
+
shell_out!(clone_cmd, run_options(:command_log_level => :info))
|
111
112
|
end
|
112
113
|
|
113
114
|
def checkout
|
114
115
|
sha_ref = target_revision
|
115
|
-
Chef::Log.info "Checking out branch: #{@new_resource.revision} reference: #{sha_ref}"
|
116
116
|
# checkout into a local branch rather than a detached HEAD
|
117
117
|
shell_out!("git checkout -b deploy #{sha_ref}", run_options(:cwd => @new_resource.destination))
|
118
|
+
Chef::Log.info "#{@new_resource} checked out branch: #{@new_resource.revision} reference: #{sha_ref}"
|
118
119
|
end
|
119
120
|
|
120
121
|
def enable_submodules
|
121
122
|
if @new_resource.enable_submodules
|
122
|
-
Chef::Log.info "
|
123
|
+
Chef::Log.info "#{@new_resource} enabling git submodules"
|
123
124
|
command = "git submodule init && git submodule update"
|
124
|
-
shell_out!(command, run_options(:cwd => @new_resource.destination))
|
125
|
+
shell_out!(command, run_options(:cwd => @new_resource.destination, :command_log_level => :info))
|
125
126
|
end
|
126
127
|
end
|
127
128
|
|
@@ -143,7 +144,7 @@ class Chef
|
|
143
144
|
def setup_remote_tracking_branches
|
144
145
|
command = []
|
145
146
|
|
146
|
-
Chef::Log.
|
147
|
+
Chef::Log.debug "#{@new_resource} configuring remote tracking branches for repository #{@new_resource.repository} "+
|
147
148
|
"at remote #{@new_resource.remote}"
|
148
149
|
command << "git config remote.#{@new_resource.remote}.url #{@new_resource.repository}"
|
149
150
|
command << "git config remote.#{@new_resource.remote}.fetch +refs/heads/*:refs/remotes/#{@new_resource.remote}/*"
|
@@ -170,6 +171,7 @@ class Chef
|
|
170
171
|
alias :revision_slug :target_revision
|
171
172
|
|
172
173
|
def remote_resolve_reference
|
174
|
+
Chef::Log.debug("#{@new_resource} resolving remote reference")
|
173
175
|
command = git('ls-remote', @new_resource.repository, @new_resource.revision)
|
174
176
|
shell_out!(command, run_options).stdout
|
175
177
|
end
|
@@ -180,6 +182,13 @@ class Chef
|
|
180
182
|
run_opts[:user] = @new_resource.user if @new_resource.user
|
181
183
|
run_opts[:group] = @new_resource.group if @new_resource.group
|
182
184
|
run_opts[:environment] = {"GIT_SSH" => @new_resource.ssh_wrapper} if @new_resource.ssh_wrapper
|
185
|
+
run_opts[:command_log_prepend] = @new_resource.to_s
|
186
|
+
run_opts[:command_log_level] ||= :debug
|
187
|
+
if run_opts[:command_log_level] == :info
|
188
|
+
if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info?
|
189
|
+
run_opts[:live_stream] = STDOUT
|
190
|
+
end
|
191
|
+
end
|
183
192
|
run_opts
|
184
193
|
end
|
185
194
|
|
data/lib/chef/provider/group.rb
CHANGED
@@ -41,7 +41,7 @@ class Chef
|
|
41
41
|
group_info = Etc.getgrnam(@new_resource.group_name)
|
42
42
|
rescue ArgumentError => e
|
43
43
|
@group_exists = false
|
44
|
-
Chef::Log.debug("#{@new_resource}
|
44
|
+
Chef::Log.debug("#{@new_resource} group does not exist")
|
45
45
|
end
|
46
46
|
|
47
47
|
if group_info
|
@@ -77,12 +77,12 @@ class Chef
|
|
77
77
|
case @group_exists
|
78
78
|
when false
|
79
79
|
create_group
|
80
|
-
Chef::Log.info("
|
80
|
+
Chef::Log.info("#{@new_resource} created")
|
81
81
|
@new_resource.updated_by_last_action(true)
|
82
82
|
else
|
83
83
|
if compare_group
|
84
84
|
manage_group
|
85
|
-
Chef::Log.info("
|
85
|
+
Chef::Log.info("#{@new_resource} altered")
|
86
86
|
@new_resource.updated_by_last_action(true)
|
87
87
|
end
|
88
88
|
end
|
@@ -92,7 +92,7 @@ class Chef
|
|
92
92
|
if @group_exists
|
93
93
|
remove_group
|
94
94
|
@new_resource.updated_by_last_action(true)
|
95
|
-
Chef::Log.info("
|
95
|
+
Chef::Log.info("#{@new_resource} removed")
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -100,7 +100,7 @@ class Chef
|
|
100
100
|
if @group_exists && compare_group
|
101
101
|
manage_group
|
102
102
|
@new_resource.updated_by_last_action(true)
|
103
|
-
Chef::Log.info("
|
103
|
+
Chef::Log.info("#{@new_resource} managed")
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -109,7 +109,7 @@ class Chef
|
|
109
109
|
if compare_group
|
110
110
|
manage_group
|
111
111
|
@new_resource.updated_by_last_action(true)
|
112
|
-
Chef::Log.info("
|
112
|
+
Chef::Log.info("#{@new_resource} modified")
|
113
113
|
end
|
114
114
|
else
|
115
115
|
raise Chef::Exceptions::Group, "Cannot modify #{@new_resource} - group does not exist!"
|
@@ -56,7 +56,7 @@ class Chef
|
|
56
56
|
{ :gid => "id" }.sort { |a,b| a[0] <=> b[0] }.each do |field, option|
|
57
57
|
if @current_resource.send(field) != @new_resource.send(field)
|
58
58
|
if @new_resource.send(field)
|
59
|
-
Chef::Log.debug("#{@new_resource}
|
59
|
+
Chef::Log.debug("#{@new_resource} setting #{field.to_s} to #{@new_resource.send(field)}")
|
60
60
|
opts << " '#{option}=#{@new_resource.send(field)}'"
|
61
61
|
end
|
62
62
|
end
|
@@ -74,12 +74,12 @@ class Chef
|
|
74
74
|
|
75
75
|
def set_members
|
76
76
|
unless @new_resource.append
|
77
|
-
Chef::Log.debug("#{@new_resource}
|
77
|
+
Chef::Log.debug("#{@new_resource} removing group members #{@current_resource.members.join(' ')}") unless @current_resource.members.empty?
|
78
78
|
safe_dscl("create /Groups/#{@new_resource.group_name} GroupMembers ''") # clear guid list
|
79
79
|
safe_dscl("create /Groups/#{@new_resource.group_name} GroupMembership ''") # clear user list
|
80
80
|
end
|
81
81
|
unless @new_resource.members.empty?
|
82
|
-
Chef::Log.debug("#{@new_resource}
|
82
|
+
Chef::Log.debug("#{@new_resource} setting group members #{@new_resource.members.join(', ')}")
|
83
83
|
safe_dscl("append /Groups/#{@new_resource.group_name} GroupMembership #{@new_resource.members.join(' ')}")
|
84
84
|
end
|
85
85
|
end
|
@@ -36,15 +36,15 @@ class Chef
|
|
36
36
|
unless @new_resource.members.empty?
|
37
37
|
if(@new_resource.append)
|
38
38
|
@new_resource.members.each do |member|
|
39
|
-
Chef::Log.debug("#{@new_resource}
|
39
|
+
Chef::Log.debug("#{@new_resource} appending member #{member} to group #{@new_resource.group_name}")
|
40
40
|
shell_out!("gpasswd -a #{member} #{@new_resource.group_name}")
|
41
41
|
end
|
42
42
|
else
|
43
|
-
Chef::Log.debug("#{@new_resource}
|
43
|
+
Chef::Log.debug("#{@new_resource} setting group members to #{@new_resource.members.join(', ')}")
|
44
44
|
shell_out!("gpasswd -M #{@new_resource.members.join(',')} #{@new_resource.group_name}")
|
45
45
|
end
|
46
46
|
else
|
47
|
-
Chef::Log.debug("#{@new_resource}
|
47
|
+
Chef::Log.debug("#{@new_resource} not changing group members, the group has no members")
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -67,8 +67,8 @@ class Chef
|
|
67
67
|
{ :gid => "-g" }.sort { |a,b| a[0] <=> b[0] }.each do |field, option|
|
68
68
|
if @current_resource.send(field) != @new_resource.send(field)
|
69
69
|
if @new_resource.send(field)
|
70
|
-
Chef::Log.debug("#{@new_resource}: setting #{field.to_s} to #{@new_resource.send(field)}")
|
71
70
|
opts << " #{option} '#{@new_resource.send(field)}'"
|
71
|
+
Chef::Log.debug("#{@new_resource} set #{field.to_s} to #{@new_resource.send(field)}")
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|