backup 4.1.1 → 4.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/lib/backup.rb +1 -0
- data/lib/backup/config/dsl.rb +1 -1
- data/lib/backup/notifier/ses.rb +94 -0
- data/lib/backup/version.rb +1 -1
- data/templates/cli/notifiers/ses +15 -0
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 151aecea39f87544f12a1633925f1c0fd641cdea
|
4
|
+
data.tar.gz: 17878e947255e0844f88eb1051f0bfa449ba13b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1882c8c062df734ddd52988c1e28af95c2ec0411c279e8e563e501b5c39ad801bb82152e7d2275df416693f9c433b54a7a2995e6d25f4f3ae91dfe0c38525e90
|
7
|
+
data.tar.gz: eeae4c0cf599fa6622141dc73e4f12d9f2b79a4046440a1c2c067f99614cc72a792ab9938e82a9be5669dc4a680ef35a8494ef4047f7b29f5355897879ef620f
|
data/README.md
CHANGED
@@ -8,10 +8,10 @@ operations. It provides an elegant DSL in Ruby for _modeling_ your backups. Back
|
|
8
8
|
databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It
|
9
9
|
was built with modularity, extensibility and simplicity in mind.
|
10
10
|
|
11
|
-
[Installation][] · [Release Notes][] · [Documentation][]
|
11
|
+
[Installation][] · [Release Notes][] · [Documentation][] · [Issues][] · [Features][]
|
12
12
|
|
13
|
-
Please use the Backup features [issue tracker]
|
14
|
-
Only use the Backup gem [issue tracker]
|
13
|
+
Please use the Backup features [issue tracker][Features] to suggest new features.
|
14
|
+
Only use the Backup gem [issue tracker][Issues] for bugs and other issues.
|
15
15
|
|
16
16
|
**Copyright (c) 2009-2014 [Michael van Rooijen][] ( [@meskyanichi][] )**
|
17
17
|
Released under the **MIT** [License](LICENSE.md).
|
@@ -19,5 +19,7 @@ Released under the **MIT** [License](LICENSE.md).
|
|
19
19
|
[Installation]: http://meskyanichi.github.io/backup/v4/installation
|
20
20
|
[Release Notes]: http://meskyanichi.github.io/backup/v4/release-notes
|
21
21
|
[Documentation]: http://meskyanichi.github.io/backup/v4
|
22
|
+
[Issues]: https://github.com/meskyanichi/backup/issues
|
23
|
+
[Features]: https://github.com/meskyanichi/backup-features/issues
|
22
24
|
[Michael van Rooijen]: http://michaelvanrooijen.com
|
23
25
|
[@meskyanichi]: http://twitter.com/#!/meskyanichi
|
data/lib/backup.rb
CHANGED
@@ -115,6 +115,7 @@ module Backup
|
|
115
115
|
autoload :FlowDock, File.join(NOTIFIER_PATH, 'flowdock')
|
116
116
|
autoload :Zabbix, File.join(NOTIFIER_PATH, 'zabbix')
|
117
117
|
autoload :DataDog, File.join(NOTIFIER_PATH, 'datadog')
|
118
|
+
autoload :Ses, File.join(NOTIFIER_PATH, 'ses')
|
118
119
|
end
|
119
120
|
|
120
121
|
##
|
data/lib/backup/config/dsl.rb
CHANGED
@@ -0,0 +1,94 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'aws/ses'
|
3
|
+
|
4
|
+
module Backup
|
5
|
+
module Notifier
|
6
|
+
class Ses < Base
|
7
|
+
|
8
|
+
##
|
9
|
+
# Amazon Simple Email Service (SES) Credentials
|
10
|
+
attr_accessor :access_key_id, :secret_access_key
|
11
|
+
|
12
|
+
##
|
13
|
+
# SES Region
|
14
|
+
attr_accessor :region
|
15
|
+
|
16
|
+
##
|
17
|
+
# Sender Email Address
|
18
|
+
attr_accessor :from
|
19
|
+
|
20
|
+
##
|
21
|
+
# Receiver Email Address
|
22
|
+
attr_accessor :to
|
23
|
+
|
24
|
+
def initialize(model, &block)
|
25
|
+
super
|
26
|
+
instance_eval(&block) if block_given?
|
27
|
+
|
28
|
+
@region ||= 'eu-west-1'
|
29
|
+
@send_log_on ||= [:warning, :failure]
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Array of statuses for which the log file should be attached.
|
34
|
+
#
|
35
|
+
# Available statuses are: `:success`, `:warning` and `:failure`.
|
36
|
+
# Default: [:warning, :failure]
|
37
|
+
attr_accessor :send_log_on
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def client
|
42
|
+
AWS::SES::Base.new(
|
43
|
+
:access_key_id => access_key_id,
|
44
|
+
:secret_access_key => secret_access_key,
|
45
|
+
:server => "email.#{region}.amazonaws.com"
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Notify the user of the backup operation results.
|
51
|
+
#
|
52
|
+
# `status` indicates one of the following:
|
53
|
+
#
|
54
|
+
# `:success`
|
55
|
+
# : The backup completed successfully.
|
56
|
+
# : Notification will be sent if `on_success` is `true`.
|
57
|
+
#
|
58
|
+
# `:warning`
|
59
|
+
# : The backup completed successfully, but warnings were logged.
|
60
|
+
# : Notification will be sent, including a copy of the current
|
61
|
+
# : backup log, if `on_warning` or `on_success` is `true`.
|
62
|
+
#
|
63
|
+
# `:failure`
|
64
|
+
# : The backup operation failed.
|
65
|
+
# : Notification will be sent, including a copy of the current
|
66
|
+
# : backup log, if `on_failure` is `true`.
|
67
|
+
#
|
68
|
+
def notify!(status)
|
69
|
+
tag = case status
|
70
|
+
when :success then '[Backup::Success]'
|
71
|
+
when :warning then '[Backup::Warning]'
|
72
|
+
when :failure then '[Backup::Failure]'
|
73
|
+
end
|
74
|
+
|
75
|
+
email = ::Mail.new(:to => to, :from => from)
|
76
|
+
email.subject = "#{ tag } #{ model.label } (#{ model.trigger })"
|
77
|
+
|
78
|
+
send_log = send_log_on.include?(status)
|
79
|
+
template = Backup::Template.new({ :model => model, :send_log => send_log })
|
80
|
+
email.body = template.result('notifier/mail/%s.erb' % status.to_s)
|
81
|
+
|
82
|
+
if send_log
|
83
|
+
email.convert_to_multipart
|
84
|
+
email.attachments["#{ model.time }.#{ model.trigger }.log"] = {
|
85
|
+
:mime_type => 'text/plain;',
|
86
|
+
:content => Logger.messages.map(&:formatted_lines).flatten.join("\n")
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
client.send_raw_email(email)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
data/lib/backup/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
##
|
2
|
+
# SES [Notifier]
|
3
|
+
#
|
4
|
+
notify_by Ses do |ses|
|
5
|
+
ses.on_success = true
|
6
|
+
ses.on_warning = true
|
7
|
+
ses.on_failure = true
|
8
|
+
|
9
|
+
ses.access_key_id = ''
|
10
|
+
ses.secret_access_key = ''
|
11
|
+
ses.region = 'eu-west-1'
|
12
|
+
|
13
|
+
ses.from = "sender@email.com"
|
14
|
+
ses.to = "receiver@email.com"
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van Rooijen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.14
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aws-ses
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: buftok
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -570,6 +584,20 @@ dependencies:
|
|
570
584
|
- - '='
|
571
585
|
- !ruby/object:Gem::Version
|
572
586
|
version: 0.0.6
|
587
|
+
- !ruby/object:Gem::Dependency
|
588
|
+
name: xml-simple
|
589
|
+
requirement: !ruby/object:Gem::Requirement
|
590
|
+
requirements:
|
591
|
+
- - '='
|
592
|
+
- !ruby/object:Gem::Version
|
593
|
+
version: 1.1.4
|
594
|
+
type: :runtime
|
595
|
+
prerelease: false
|
596
|
+
version_requirements: !ruby/object:Gem::Requirement
|
597
|
+
requirements:
|
598
|
+
- - '='
|
599
|
+
- !ruby/object:Gem::Version
|
600
|
+
version: 1.1.4
|
573
601
|
description: Backup is a RubyGem, written for UNIX-like operating systems, that allows
|
574
602
|
you to easily perform backup operations on both your remote and local environments.
|
575
603
|
It provides you with an elegant DSL in Ruby for modeling your backups. Backup has
|
@@ -629,6 +657,7 @@ files:
|
|
629
657
|
- lib/backup/notifier/pagerduty.rb
|
630
658
|
- lib/backup/notifier/prowl.rb
|
631
659
|
- lib/backup/notifier/pushover.rb
|
660
|
+
- lib/backup/notifier/ses.rb
|
632
661
|
- lib/backup/notifier/slack.rb
|
633
662
|
- lib/backup/notifier/twitter.rb
|
634
663
|
- lib/backup/notifier/zabbix.rb
|
@@ -685,6 +714,7 @@ files:
|
|
685
714
|
- templates/cli/notifiers/pagerduty
|
686
715
|
- templates/cli/notifiers/prowl
|
687
716
|
- templates/cli/notifiers/pushover
|
717
|
+
- templates/cli/notifiers/ses
|
688
718
|
- templates/cli/notifiers/slack
|
689
719
|
- templates/cli/notifiers/twitter
|
690
720
|
- templates/cli/splitter
|