chef 0.10.0.beta.6 → 0.10.0.beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -30,16 +30,15 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
|
|
30
30
|
|
31
31
|
raise Chef::Exceptions::Service unless ::File.exists?("/sbin/rc-update")
|
32
32
|
|
33
|
-
Chef::Log.debug "#{@new_resource}: checking service enable state"
|
34
33
|
@current_resource.enabled(
|
35
34
|
Dir.glob("/etc/runlevels/**/#{@current_resource.service_name}").any? do |file|
|
36
35
|
exists = ::File.exists? file
|
37
36
|
readable = ::File.readable? file
|
38
|
-
Chef::Log.debug "#{@new_resource}
|
37
|
+
Chef::Log.debug "#{@new_resource} exists: #{exists}, readable: #{readable}"
|
39
38
|
exists and readable
|
40
39
|
end
|
41
40
|
)
|
42
|
-
Chef::Log.debug "#{@new_resource}
|
41
|
+
Chef::Log.debug "#{@new_resource} enabled: #{@current_resource.enabled}"
|
43
42
|
|
44
43
|
@current_resource
|
45
44
|
end
|
@@ -32,6 +32,7 @@ class Chef
|
|
32
32
|
begin
|
33
33
|
if run_command(:command => @new_resource.status_command) == 0
|
34
34
|
@current_resource.running true
|
35
|
+
Chef::Log.debug("#{@new_resource} is running")
|
35
36
|
end
|
36
37
|
rescue Chef::Exceptions::Exec
|
37
38
|
@current_resource.running false
|
@@ -44,19 +45,20 @@ class Chef
|
|
44
45
|
begin
|
45
46
|
if run_command(:command => "#{@init_command} status") == 0
|
46
47
|
@current_resource.running true
|
48
|
+
Chef::Log.debug("#{@new_resource} is running")
|
47
49
|
end
|
48
50
|
rescue Chef::Exceptions::Exec
|
49
51
|
@current_resource.running false
|
50
52
|
nil
|
51
53
|
end
|
52
54
|
elsif
|
53
|
-
Chef::Log.debug "#{@new_resource}
|
55
|
+
Chef::Log.debug "#{@new_resource} falling back to process table inspection"
|
54
56
|
if ps_cmd.nil? or ps_cmd.empty?
|
55
|
-
raise Chef::Exceptions::Service, "#{@new_resource}
|
57
|
+
raise Chef::Exceptions::Service, "#{@new_resource} could not determine how to inspect the process table, please set this nodes 'command.ps' attribute"
|
56
58
|
end
|
57
59
|
status = popen4(ps_cmd) do |pid, stdin, stdout, stderr|
|
58
60
|
r = Regexp.new(@new_resource.pattern)
|
59
|
-
Chef::Log.debug "#{@new_resource}
|
61
|
+
Chef::Log.debug "#{@new_resource} attempting to match '#{@new_resource.pattern}' (#{r.inspect}) against process list"
|
60
62
|
stdout.each_line do |line|
|
61
63
|
if r.match(line)
|
62
64
|
@current_resource.running true
|
@@ -68,7 +70,7 @@ class Chef
|
|
68
70
|
unless status.exitstatus == 0
|
69
71
|
raise Chef::Exceptions::Service, "Command #{ps_cmd} failed"
|
70
72
|
else
|
71
|
-
Chef::Log.debug "#{@new_resource}
|
73
|
+
Chef::Log.debug "#{@new_resource} running: #{@current_resource.running}"
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
@@ -108,7 +110,7 @@ class Chef
|
|
108
110
|
raise Chef::Exceptions::Service, "#{self.to_s} requires that reload_command to be set"
|
109
111
|
end
|
110
112
|
end
|
111
|
-
|
113
|
+
|
112
114
|
def ps_cmd
|
113
115
|
@run_context.node[:command] && @run_context.node[:command][:ps]
|
114
116
|
end
|
@@ -86,23 +86,23 @@ class Chef
|
|
86
86
|
|
87
87
|
# Get enabled/disabled state by reading job configuration file
|
88
88
|
if ::File.exists?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
|
89
|
-
Chef::Log.debug("#{@new_resource}
|
89
|
+
Chef::Log.debug("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
|
90
90
|
::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}",'r') do |file|
|
91
91
|
while line = file.gets
|
92
92
|
case line
|
93
93
|
when /^start on/
|
94
|
-
Chef::Log.debug("#{@new_resource}
|
94
|
+
Chef::Log.debug("#{@new_resource} enabled: #{line.chomp}")
|
95
95
|
@current_resource.enabled true
|
96
96
|
break
|
97
97
|
when /^#start on/
|
98
|
-
Chef::Log.debug("#{@new_resource}
|
98
|
+
Chef::Log.debug("#{@new_resource} disabled: #{line.chomp}")
|
99
99
|
@current_resource.enabled false
|
100
100
|
break
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
104
104
|
else
|
105
|
-
Chef::Log.debug("#{@new_resource}
|
105
|
+
Chef::Log.debug("#{@new_resource} did not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
|
106
106
|
@current_resource.enabled false
|
107
107
|
end
|
108
108
|
|
@@ -113,7 +113,7 @@ class Chef
|
|
113
113
|
# Calling start on a service that is already started will return 1
|
114
114
|
# Our 'goal' when we call start is to ensure the service is started
|
115
115
|
if @current_resource.running
|
116
|
-
Chef::Log.debug("#{@new_resource}
|
116
|
+
Chef::Log.debug("#{@new_resource} already running, not starting")
|
117
117
|
else
|
118
118
|
if @new_resource.start_command
|
119
119
|
super
|
@@ -127,7 +127,7 @@ class Chef
|
|
127
127
|
# Calling stop on a service that is already stopped will return 1
|
128
128
|
# Our 'goal' when we call stop is to ensure the service is stopped
|
129
129
|
unless @current_resource.running
|
130
|
-
Chef::Log.debug("#{@new_resource}
|
130
|
+
Chef::Log.debug("#{@new_resource} not running, not stopping")
|
131
131
|
else
|
132
132
|
if @new_resource.stop_command
|
133
133
|
super
|
@@ -157,14 +157,14 @@ class Chef
|
|
157
157
|
# https://bugs.launchpad.net/upstart/+bug/94065
|
158
158
|
|
159
159
|
def enable_service
|
160
|
-
Chef::Log.
|
160
|
+
Chef::Log.debug("#{@new_resource} upstart lacks inherent support for enabling services, editing job config file")
|
161
161
|
conf = Chef::Util::FileEdit.new("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
|
162
162
|
conf.search_file_replace(/^#start on/, "start on")
|
163
163
|
conf.write_file
|
164
164
|
end
|
165
165
|
|
166
166
|
def disable_service
|
167
|
-
Chef::Log.
|
167
|
+
Chef::Log.debug("#{@new_resource} upstart lacks inherent support for disabling services, editing job config file")
|
168
168
|
conf = Chef::Util::FileEdit.new("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
|
169
169
|
conf.search_file_replace(/^start on/, "#start on")
|
170
170
|
conf.write_file
|
@@ -55,7 +55,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service::Simple
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
Chef::Log.debug "#{@new_resource}
|
58
|
+
Chef::Log.debug "#{@new_resource} running: #{@current_resource.running}"
|
59
59
|
rescue Exception => e
|
60
60
|
raise Chef::Exceptions::Service, "Exception determining state of service #{@new_resource.service_name}: #{e.message}"
|
61
61
|
end
|
@@ -83,7 +83,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service::Simple
|
|
83
83
|
def stop_service
|
84
84
|
begin
|
85
85
|
if @new_resource.stop_command
|
86
|
-
Chef::Log.debug "stopping service using the given stop_command"
|
86
|
+
Chef::Log.debug "#{@new_resource} stopping service using the given stop_command"
|
87
87
|
popen4(@new_resource.stop_command) do |pid, stdin, stdout, stderr|
|
88
88
|
Chef::Log.debug stdout.readlines
|
89
89
|
end
|
@@ -103,7 +103,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service::Simple
|
|
103
103
|
def restart_service
|
104
104
|
begin
|
105
105
|
if @new_resource.restart_command
|
106
|
-
Chef::Log.debug "restarting service using the given restart_command"
|
106
|
+
Chef::Log.debug "#{@new_resource} restarting service using the given restart_command"
|
107
107
|
popen4(@new_resource.restart_command) do |pid, stdin, stdout, stderr|
|
108
108
|
Chef::Log.debug stdout.readlines
|
109
109
|
end
|
@@ -44,7 +44,7 @@ class Chef
|
|
44
44
|
run_command(run_options(:command => checkout_command))
|
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 - nothing to do"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -54,7 +54,7 @@ class Chef
|
|
54
54
|
run_command(run_options(:command => export_command))
|
55
55
|
@new_resource.updated_by_last_action(true)
|
56
56
|
else
|
57
|
-
Chef::Log.
|
57
|
+
Chef::Log.debug "#{@new_resource} export destination #{@new_resource.destination} already exists or is a non-empty directory - nothing to do"
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -81,22 +81,25 @@ class Chef
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def sync_command
|
84
|
-
|
85
|
-
|
84
|
+
c = scm :update, @new_resource.svn_arguments, verbose, authentication, "-r#{revision_int}", @new_resource.destination
|
85
|
+
Chef::Log.debug "#{@new_resource} updated working copy #{@new_resource.destination} to revision #{@new_resource.revision}"
|
86
|
+
c
|
86
87
|
end
|
87
88
|
|
88
89
|
def checkout_command
|
89
|
-
|
90
|
-
scm :checkout, @new_resource.svn_arguments, verbose, authentication,
|
90
|
+
c = scm :checkout, @new_resource.svn_arguments, verbose, authentication,
|
91
91
|
"-r#{revision_int}", @new_resource.repository, @new_resource.destination
|
92
|
+
Chef::Log.info "#{@new_resource} checked out #{@new_resource.repository} at revision #{@new_resource.revision} to #{@new_resource.destination}"
|
93
|
+
c
|
92
94
|
end
|
93
95
|
|
94
96
|
def export_command
|
95
|
-
Chef::Log.info "exporting #{@new_resource.repository} at revision #{@new_resource.revision} to #{@new_resource.destination}"
|
96
97
|
args = ["--force"]
|
97
98
|
args << @new_resource.svn_arguments << verbose << authentication <<
|
98
99
|
"-r#{revision_int}" << @new_resource.repository << @new_resource.destination
|
99
|
-
scm :export, *args
|
100
|
+
c = scm :export, *args
|
101
|
+
Chef::Log.info "#{@new_resource} exported #{@new_resource.repository} at revision #{@new_resource.revision} to #{@new_resource.destination}"
|
102
|
+
c
|
100
103
|
end
|
101
104
|
|
102
105
|
# If the specified revision isn't an integer ("HEAD" for example), look
|
@@ -157,7 +160,7 @@ class Chef
|
|
157
160
|
end
|
158
161
|
raise "Could not parse `svn info` data: #{svn_info}" unless repo_attrs.kind_of?(Hash)
|
159
162
|
rev = (repo_attrs['Last Changed Rev'] || repo_attrs['Revision']).to_s
|
160
|
-
Chef::Log.debug "
|
163
|
+
Chef::Log.debug "#{@new_resource} resolved revision #{@new_resource.revision} to #{rev}"
|
161
164
|
rev
|
162
165
|
end
|
163
166
|
|
@@ -42,10 +42,10 @@ class Chef
|
|
42
42
|
Chef::Log.debug("#{@new_resource} content has not changed.")
|
43
43
|
set_all_access_controls(@new_resource.path)
|
44
44
|
else
|
45
|
-
Chef::Log.info("Writing updated content for #{@new_resource} to #{@new_resource.path}")
|
46
45
|
backup
|
47
46
|
set_all_access_controls(rendered_template.path)
|
48
47
|
FileUtils.mv(rendered_template.path, @new_resource.path)
|
48
|
+
Chef::Log.info("#{@new_resource} updated content")
|
49
49
|
@new_resource.updated_by_last_action(true)
|
50
50
|
end
|
51
51
|
end
|
@@ -53,14 +53,13 @@ class Chef
|
|
53
53
|
|
54
54
|
def action_create_if_missing
|
55
55
|
if ::File.exists?(@new_resource.path)
|
56
|
-
Chef::Log.debug("
|
56
|
+
Chef::Log.debug("#{@new_resource} exists - taking no action")
|
57
57
|
else
|
58
58
|
action_create
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
def template_location
|
63
|
-
Chef::Log.debug("looking for template #{@new_resource.source} in cookbook #{cookbook_name.inspect}")
|
64
63
|
@template_file_cache_location ||= begin
|
65
64
|
if @new_resource.local
|
66
65
|
@new_resource.source
|
data/lib/chef/provider/user.rb
CHANGED
@@ -51,7 +51,7 @@ class Chef
|
|
51
51
|
user_info = Etc.getpwnam(@new_resource.username)
|
52
52
|
rescue ArgumentError => e
|
53
53
|
@user_exists = false
|
54
|
-
Chef::Log.debug("
|
54
|
+
Chef::Log.debug("#{@new_resource} user does not exist")
|
55
55
|
user_info = nil
|
56
56
|
end
|
57
57
|
|
@@ -67,7 +67,6 @@ class Chef
|
|
67
67
|
begin
|
68
68
|
require 'shadow'
|
69
69
|
rescue LoadError
|
70
|
-
Chef::Log.error("You must have ruby-shadow installed for password support!")
|
71
70
|
raise Chef::Exceptions::MissingLibrary, "You must have ruby-shadow installed for password support!"
|
72
71
|
else
|
73
72
|
shadow_info = Shadow::Passwd.getspnam(@new_resource.username)
|
@@ -97,11 +96,11 @@ class Chef
|
|
97
96
|
def action_create
|
98
97
|
if !@user_exists
|
99
98
|
create_user
|
100
|
-
Chef::Log.info("
|
99
|
+
Chef::Log.info("#{@new_resource} created")
|
101
100
|
@new_resource.updated_by_last_action(true)
|
102
101
|
elsif compare_user
|
103
102
|
manage_user
|
104
|
-
Chef::Log.info("
|
103
|
+
Chef::Log.info("#{@new_resource} altered")
|
105
104
|
@new_resource.updated_by_last_action(true)
|
106
105
|
end
|
107
106
|
end
|
@@ -110,7 +109,7 @@ class Chef
|
|
110
109
|
if @user_exists
|
111
110
|
remove_user
|
112
111
|
@new_resource.updated_by_last_action(true)
|
113
|
-
Chef::Log.info("
|
112
|
+
Chef::Log.info("#{@new_resource} removed")
|
114
113
|
end
|
115
114
|
end
|
116
115
|
|
@@ -122,7 +121,7 @@ class Chef
|
|
122
121
|
if @user_exists && compare_user
|
123
122
|
manage_user
|
124
123
|
@new_resource.updated_by_last_action(true)
|
125
|
-
Chef::Log.info("
|
124
|
+
Chef::Log.info("#{@new_resource} managed")
|
126
125
|
end
|
127
126
|
end
|
128
127
|
|
@@ -135,10 +134,10 @@ class Chef
|
|
135
134
|
if compare_user
|
136
135
|
manage_user
|
137
136
|
@new_resource.updated_by_last_action(true)
|
138
|
-
Chef::Log.info("
|
137
|
+
Chef::Log.info("#{@new_resource} modified")
|
139
138
|
end
|
140
139
|
else
|
141
|
-
raise Chef::Exceptions::User, "Cannot modify
|
140
|
+
raise Chef::Exceptions::User, "Cannot modify user - does not exist!"
|
142
141
|
end
|
143
142
|
end
|
144
143
|
|
@@ -147,12 +146,12 @@ class Chef
|
|
147
146
|
if check_lock() == false
|
148
147
|
lock_user
|
149
148
|
@new_resource.updated_by_last_action(true)
|
150
|
-
Chef::Log.info("
|
149
|
+
Chef::Log.info("#{@new_resource} locked")
|
151
150
|
else
|
152
|
-
Chef::Log.debug("
|
151
|
+
Chef::Log.debug("#{@new_resource} already locked - nothing to do")
|
153
152
|
end
|
154
153
|
else
|
155
|
-
raise Chef::Exceptions::User, "Cannot lock
|
154
|
+
raise Chef::Exceptions::User, "Cannot lock user - does not exist!"
|
156
155
|
end
|
157
156
|
end
|
158
157
|
|
@@ -169,12 +168,12 @@ class Chef
|
|
169
168
|
if check_lock() == true
|
170
169
|
unlock_user
|
171
170
|
@new_resource.updated_by_last_action(true)
|
172
|
-
Chef::Log.info("
|
171
|
+
Chef::Log.info("#{@new_resource} unlocked")
|
173
172
|
else
|
174
|
-
Chef::Log.debug("
|
173
|
+
Chef::Log.debug("#{@new_resource} already unlocked - nothing to do")
|
175
174
|
end
|
176
175
|
else
|
177
|
-
raise Chef::Exceptions::User, "Cannot unlock
|
176
|
+
raise Chef::Exceptions::User, "Cannot unlock user - does not exist!"
|
178
177
|
end
|
179
178
|
end
|
180
179
|
|
@@ -117,7 +117,7 @@ class Chef
|
|
117
117
|
if @new_resource.password
|
118
118
|
shadow_hash = nil
|
119
119
|
|
120
|
-
Chef::Log.debug("#{new_resource}
|
120
|
+
Chef::Log.debug("#{new_resource} updating password")
|
121
121
|
if osx_shadow_hash?(@new_resource.password)
|
122
122
|
shadow_hash = @new_resource.password.upcase
|
123
123
|
else
|
@@ -257,7 +257,7 @@ class Chef
|
|
257
257
|
end
|
258
258
|
|
259
259
|
def move_home
|
260
|
-
Chef::Log.debug("moving #{self} home from #{@current_resource.home} to #{@new_resource.home}")
|
260
|
+
Chef::Log.debug("#{@new_resource} moving #{self} home from #{@current_resource.home} to #{@new_resource.home}")
|
261
261
|
|
262
262
|
src = @current_resource.home
|
263
263
|
FileUtils.mkdir_p(@new_resource.home)
|
@@ -80,13 +80,13 @@ class Chef
|
|
80
80
|
field_symbol = field.to_sym
|
81
81
|
if @current_resource.send(field_symbol) != @new_resource.send(field_symbol)
|
82
82
|
if @new_resource.send(field_symbol)
|
83
|
-
Chef::Log.debug("
|
83
|
+
Chef::Log.debug("#{@new_resource} setting #{field} to #{@new_resource.send(field_symbol)}")
|
84
84
|
opts << " #{option} '#{@new_resource.send(field_symbol)}'"
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
88
88
|
if @new_resource.supports[:manage_home]
|
89
|
-
Chef::Log.debug("
|
89
|
+
Chef::Log.debug("#{@new_resource} is managing the users home directory")
|
90
90
|
opts << " -m"
|
91
91
|
end
|
92
92
|
opts
|
@@ -94,7 +94,7 @@ class Chef
|
|
94
94
|
|
95
95
|
def modify_password
|
96
96
|
if @current_resource.password != @new_resource.password
|
97
|
-
Chef::Log.debug("#{new_resource}
|
97
|
+
Chef::Log.debug("#{new_resource} updating password")
|
98
98
|
command = "pw usermod #{@new_resource.username} -H 0"
|
99
99
|
status = popen4(command, :waitlast => true) do |pid, stdin, stdout, stderr|
|
100
100
|
stdin.puts "#{@new_resource.password}"
|
@@ -104,7 +104,7 @@ class Chef
|
|
104
104
|
raise Chef::Exceptions::User, "pw failed - #{status.inspect}!"
|
105
105
|
end
|
106
106
|
else
|
107
|
-
Chef::Log.debug("#{new_resource}
|
107
|
+
Chef::Log.debug("#{new_resource} no change needed to password")
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -98,17 +98,17 @@ class Chef
|
|
98
98
|
UNIVERSAL_OPTIONS.each do |field, option|
|
99
99
|
if @current_resource.send(field) != @new_resource.send(field)
|
100
100
|
if @new_resource.send(field)
|
101
|
-
Chef::Log.debug("
|
101
|
+
Chef::Log.debug("#{@new_resource} setting #{field} to #{@new_resource.send(field)}")
|
102
102
|
opts << " #{option} '#{@new_resource.send(field)}'"
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
106
106
|
if updating_home?
|
107
107
|
if managing_home_dir?
|
108
|
-
Chef::Log.debug("
|
108
|
+
Chef::Log.debug("#{@new_resource} managing the users home directory")
|
109
109
|
opts << " -d '#{@new_resource.home}'"
|
110
110
|
else
|
111
|
-
Chef::Log.debug("
|
111
|
+
Chef::Log.debug("#{@new_resource} setting home to #{@new_resource.home}")
|
112
112
|
opts << " -d '#{@new_resource.home}'"
|
113
113
|
end
|
114
114
|
end
|
@@ -39,7 +39,7 @@ class Chef
|
|
39
39
|
user_info = @net_user.get_info
|
40
40
|
rescue
|
41
41
|
@user_exists = false
|
42
|
-
Chef::Log.debug("
|
42
|
+
Chef::Log.debug("#{@new_resource} does not exist")
|
43
43
|
end
|
44
44
|
|
45
45
|
if user_info
|
@@ -60,7 +60,7 @@ class Chef
|
|
60
60
|
# <false>:: If the users are identical
|
61
61
|
def compare_user
|
62
62
|
unless @net_user.validate_credentials(@new_resource.password)
|
63
|
-
Chef::Log.debug("
|
63
|
+
Chef::Log.debug("#{@new_resource} password has changed")
|
64
64
|
return true
|
65
65
|
end
|
66
66
|
[ :uid, :gid, :comment, :home, :shell ].any? do |user_attrib|
|
@@ -109,7 +109,7 @@ class Chef
|
|
109
109
|
if @current_resource.send(field_symbol) != @new_resource.send(field_symbol)
|
110
110
|
if @new_resource.send(field_symbol)
|
111
111
|
unless field_symbol == :password
|
112
|
-
Chef::Log.debug("
|
112
|
+
Chef::Log.debug("#{@new_resource} setting #{field} to #{@new_resource.send(field_symbol)}")
|
113
113
|
end
|
114
114
|
opts[option.to_sym] = @new_resource.send(field_symbol)
|
115
115
|
end
|
data/lib/chef/resource.rb
CHANGED
@@ -240,7 +240,7 @@ F
|
|
240
240
|
notifications.each do |resources_notifications|
|
241
241
|
resources_notifications.each do |resource, notification|
|
242
242
|
action, timing = notification[0], notification[1]
|
243
|
-
Chef::Log.debug "
|
243
|
+
Chef::Log.debug "Adding notification from resource #{self} to `#{resource.inspect}' => `#{notification.inspect}'"
|
244
244
|
add_notification(action, resource, timing)
|
245
245
|
end
|
246
246
|
end
|
@@ -419,8 +419,9 @@ F
|
|
419
419
|
Chef::Log.error("#{self} (#{defined_at}) had an error: #{e.message}")
|
420
420
|
else
|
421
421
|
Chef::Log.error("#{self} (#{defined_at}) has had an error")
|
422
|
-
|
423
|
-
|
422
|
+
new_exception = e.exception("#{self} (#{defined_at}) had an error: #{e.message}")
|
423
|
+
new_exception.set_backtrace(e.backtrace)
|
424
|
+
raise new_exception
|
424
425
|
end
|
425
426
|
end
|
426
427
|
end
|