chef-notifier 1.0.1 → 1.0.2

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.
@@ -1,3 +1,6 @@
1
+ === v1.0.2
2
+ * Return self on setup
3
+
1
4
  === v1.0.1
2
5
  * Use pony over mail to avoid conflicts
3
6
 
data/LICENSE CHANGED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Chris Roberts <chrisroberts.code@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
17
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+
@@ -0,0 +1,45 @@
1
+ == Chef Notifier
2
+
3
+ Notifications from chef. Currently only notification via mail.
4
+
5
+ === Basic usage
6
+
7
+ require 'chef-notifier/mail'
8
+
9
+ Chef::Config.exception_handlers << ChefNotifier::Mailer.instance.setup(:recipients => ['some_email@example.com'])
10
+
11
+ === Extra fun
12
+
13
+ The mailer has logger type methods available. This is to provide notifications from chef
14
+ based on encountered states. The mailer is a singleton, which allows a recipe to determine
15
+ what users should receive mail notifications (via user databags most likely). Once setup,
16
+ other cookbook recipes can then include the recipe and use the methods for easy reporting.
17
+
18
+ ==== Example (using user databags):
19
+
20
+ include_recipe 'ssmtp'
21
+
22
+ notifier_gem = gem_package 'chef-notifier' do
23
+ action :nothing
24
+ version '~> 1.0'
25
+ end
26
+ notifier_gem.run_action(:install)
27
+ Gem.clear_paths
28
+ require 'rubygems'
29
+ require 'chef-notifier/mail'
30
+
31
+ if(File.exists?('/usr/sbin/sendmail'))
32
+ users = search(:users).find_all{|user| user['chef_notifications']}.map{|user| user[:email]}.compact
33
+ notifier = ChefNotifier::Mailer.instance.setup(
34
+ :recipients => users,
35
+ :delivery => {
36
+ :method => :sendmail,
37
+ :arguments => '-i'
38
+ }
39
+ )
40
+ Chef::Config.exception_handlers << ChefNotifier::Mailer.instance
41
+ Chef::Log.info "Emails added to notifications: #{users.join(', ')}"
42
+ else
43
+ Chef::Log.warn "No emails found for notifications"
44
+ end
45
+
@@ -10,6 +10,7 @@ module ChefNotifier
10
10
 
11
11
  def setup(args={})
12
12
  @args = {:delivery => {:method => :sendmail, :arguments => '-i'}}.merge(args)
13
+ self
13
14
  end
14
15
 
15
16
  def report
@@ -13,5 +13,5 @@ module ChefNotifier
13
13
  end
14
14
  end
15
15
 
16
- VERSION = Version.new('1.0.1')
16
+ VERSION = Version.new('1.0.2')
17
17
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-notifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Roberts
@@ -46,7 +46,6 @@ files:
46
46
  - README.rdoc
47
47
  - CHANGELOG.rdoc
48
48
  - chef-notifier.gemspec
49
- - chef-notifier-1.0.0.gem
50
49
  - lib/chef-notifier.rb
51
50
  - lib/chef-notifier/mail.rb
52
51
  - lib/chef-notifier/version.rb
Binary file