chef-handler-users 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/chef-handler-users.gemspec +1 -1
- data/lib/chef-handler-users.rb +9 -7
- metadata +1 -1
data/chef-handler-users.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "chef-handler-users"
|
6
|
-
gem.version = "0.0.
|
6
|
+
gem.version = "0.0.12"
|
7
7
|
gem.authors = ["Heavy Water Operations, LLC. (OR)"]
|
8
8
|
gem.email = ["ops@hw-ops.com"]
|
9
9
|
gem.homepage = "http://github.com/heavywater/chef-handler-users"
|
data/lib/chef-handler-users.rb
CHANGED
@@ -38,18 +38,20 @@ class Chef::Handler::Users < Chef::Handler
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def report
|
41
|
-
updated_users = []
|
42
|
-
|
43
|
-
|
44
|
-
resource.resource_name == "user"
|
41
|
+
updated_users = run_status.updated_resources.inject([]) do |updated_users, resource|
|
42
|
+
updated_users << resource if resource.resource_name == "user"
|
43
|
+
updated_users
|
45
44
|
end
|
46
45
|
|
47
|
-
|
46
|
+
if updated_users.empty?
|
47
|
+
return
|
48
|
+
else
|
49
|
+
Chef::Log.info "Users handler detected #{updated_users.length} user changes. Generating summary email for #{@config[:to_address]}"
|
50
|
+
end
|
48
51
|
|
49
52
|
subject = "Chef run on #{node.name} at #{Time.now} resulted in change of #{updated_users.length} users"
|
50
|
-
message = generate_email_body(updated_users)
|
51
53
|
|
52
|
-
|
54
|
+
message = generate_email_body(updated_users)
|
53
55
|
|
54
56
|
Pony.mail(:to => @config[:to_address],
|
55
57
|
:from => @config[:from_address],
|