berta 2.0.1 → 2.1.1
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.
- checksums.yaml +4 -4
- data/config/berta.yml +4 -0
- data/lib/berta/cli.rb +17 -1
- data/lib/berta/notification.rb +1 -1
- data/lib/berta/utils/opennebula/helper.rb +1 -3
- data/lib/berta/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82c2cf0ec358add6bb0761c552826a77786f56e9
|
4
|
+
data.tar.gz: c1361678b6f0207229a8c02683313c753bf2a467
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 823f3e32829e096a4ac82f0a2a1de3da87759aae0133cb9639c1d9ffbae2f6cf1d61a8e8a8229efdc507dd7a7f31282b9d463b4d076f3c4ae7af21d8c5084845
|
7
|
+
data.tar.gz: 41fc6aea27a9662444ba370aaf161ad756bc66fbaad307cb704b722f0ad21dea5a4443038e71dca3f634e3d3cdf0eb95af62d842e12cede84ed9e94f6b4de95a
|
data/config/berta.yml
CHANGED
data/lib/berta/cli.rb
CHANGED
@@ -64,6 +64,16 @@ module Berta
|
|
64
64
|
required: true,
|
65
65
|
default: safe_fetch(%w[email-template]),
|
66
66
|
type: :string
|
67
|
+
class_option :'email-type',
|
68
|
+
required: true,
|
69
|
+
default: safe_fetch(%w[email-type]),
|
70
|
+
type: :string
|
71
|
+
class_option :'smtp-address',
|
72
|
+
default: safe_fetch(%w[smtp address]),
|
73
|
+
type: :string
|
74
|
+
class_option :'smtp-port',
|
75
|
+
default: safe_fetch(%w[smtp port]),
|
76
|
+
type: :numeric
|
67
77
|
|
68
78
|
desc 'cleanup', 'Task that sets all expiration to all vms and notifies users'
|
69
79
|
def cleanup
|
@@ -105,6 +115,9 @@ module Berta
|
|
105
115
|
settings['logging']['file'] = options['logging-file']
|
106
116
|
settings['logging']['level'] = options['logging-level']
|
107
117
|
settings['email-template'] = options['email-template']
|
118
|
+
settings['email-type'] = options['email-type']
|
119
|
+
settings['smtp']['address'] = options['smtp-address']
|
120
|
+
settings['smtp']['port'] = options['smtp-port']
|
108
121
|
Berta::Settings.merge!(settings)
|
109
122
|
end
|
110
123
|
|
@@ -129,7 +142,10 @@ module Berta
|
|
129
142
|
end
|
130
143
|
|
131
144
|
def initialize_email
|
132
|
-
|
145
|
+
email_type = Berta::Settings['email-type']
|
146
|
+
params = {}
|
147
|
+
params = Berta::Settings[email_type].each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if Berta::Settings[email_type]
|
148
|
+
Mail.defaults { delivery_method email_type.to_sym, params }
|
133
149
|
end
|
134
150
|
end
|
135
151
|
end
|
data/lib/berta/notification.rb
CHANGED
@@ -20,7 +20,7 @@ module Berta
|
|
20
20
|
text = template.render(Object.new, name: name, email: email, type: type, vms: vms_hash(vms))
|
21
21
|
logger.info "Sending mail to entity: #{name} on email: #{email}"
|
22
22
|
logger.debug { text }
|
23
|
-
Mail.
|
23
|
+
Mail.deliver(text) unless Berta::Settings['dry-run']
|
24
24
|
end
|
25
25
|
|
26
26
|
def vms_hash(vms)
|
@@ -21,9 +21,7 @@ module Berta
|
|
21
21
|
# @raise [Berta::Errors::OpenNebula::ResourceStateError]
|
22
22
|
# @raise [Berta::Errors::OpenNebula::ResourceRetrievalError]
|
23
23
|
def handle_error
|
24
|
-
unless block_given?
|
25
|
-
raise Berta::Errors::OpenNebula::StubError, 'OpenNebula service-wrapper was called without a block!'
|
26
|
-
end
|
24
|
+
raise Berta::Errors::OpenNebula::StubError, 'OpenNebula service-wrapper was called without a block!' unless block_given?
|
27
25
|
return_value = yield
|
28
26
|
return return_value unless ::OpenNebula.is_error?(return_value)
|
29
27
|
raise decode_error(return_value.errno), return_value.message
|
data/lib/berta/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dusan Baran
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|