berta 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/berta.gemspec +1 -0
- data/lib/berta/version.rb +1 -1
- data/lib/berta/virtual_machine_handler.rb +24 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e3d5595d6f87b950bd563bf4131046970d8697d
|
4
|
+
data.tar.gz: f05ff671fa9187a3b6f18a366b312e893ea50fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21df07bb8eb98444a58e5c30fe78e38805ea9816411f912a418439571bc556e620460701c27cd833f97f3a4f3c6df745433dcc24e2b99d1c58ac04010b310bf2
|
7
|
+
data.tar.gz: 8f66e09d3f8e66e5b3870fc7c528fd9fcd79db8c7ec6aef49ea59419f30a0e5cfc5e8891e7db6994187d5dcd271e7f188fbb06b03f56bc4ae8136f18e8b0a154
|
data/.travis.yml
CHANGED
data/berta.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.email = 'dbaran@hotmail.sk'
|
14
14
|
s.homepage = 'https://github.com/dudoslav/berta'
|
15
15
|
s.license = 'Apache License, Version 2.0'
|
16
|
+
s.required_ruby_version = '>= 2.1'
|
16
17
|
|
17
18
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
19
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
data/lib/berta/version.rb
CHANGED
@@ -18,15 +18,12 @@ module Berta
|
|
18
18
|
# invalid expiration it will be deleted. Other expirations
|
19
19
|
# are kept.
|
20
20
|
def update
|
21
|
-
exps = expirations
|
22
|
-
exps
|
23
|
-
if exps == expirations
|
24
|
-
|
25
|
-
else
|
26
|
-
update_expirations(exps)
|
27
|
-
end
|
21
|
+
exps = remove_invalid(expirations)
|
22
|
+
exps = add_default_expiration(exps)
|
23
|
+
return if exps == expirations
|
24
|
+
update_expirations(exps)
|
28
25
|
rescue Berta::Errors::BackendError => e
|
29
|
-
logger.error "#{e.message} on vm with id #{
|
26
|
+
logger.error "#{e.message} on vm with id #{handle['ID']}"
|
30
27
|
end
|
31
28
|
|
32
29
|
# Sets notified flag value in USER_TEMPLATE to default expiration
|
@@ -99,6 +96,25 @@ module Berta
|
|
99
96
|
|
100
97
|
private
|
101
98
|
|
99
|
+
def remove_invalid(exps)
|
100
|
+
valid = exps.select(&:in_expiration_interval?)
|
101
|
+
if valid.length != exps.length
|
102
|
+
logger.info "Removing #{exps.length - valid.length} invalid expirations on vm with" \
|
103
|
+
"id=#{handle['ID']} usr=#{handle['UNAME']} grp=#{handle['GNAME']}"
|
104
|
+
end
|
105
|
+
valid
|
106
|
+
end
|
107
|
+
|
108
|
+
def add_default_expiration(exps)
|
109
|
+
unless default_expiration
|
110
|
+
new_default = next_expiration
|
111
|
+
exps << new_default
|
112
|
+
logger.info "Adding default expiration on vm with id=#{handle['ID']} usr=#{handle['UNAME']} grp=#{handle['GNAME']}"\
|
113
|
+
", expires at #{Time.at(new_default.time)}"
|
114
|
+
end
|
115
|
+
exps
|
116
|
+
end
|
117
|
+
|
102
118
|
# Sets array of expirations to vm, rewrites all old ones.
|
103
119
|
# Receiving empty array wont change anything.
|
104
120
|
#
|
@@ -107,7 +123,6 @@ module Berta
|
|
107
123
|
def update_expirations(exps)
|
108
124
|
template = exps.inject('') { |temp, exp| temp + exp.template }
|
109
125
|
return if template == ''
|
110
|
-
logger.info "Setting expirations on vm with id=#{handle['ID']} usr=#{handle['UNAME']} grp=#{handle['GNAME']}"
|
111
126
|
logger.debug template.delete("\n ")
|
112
127
|
send_update(template)
|
113
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dusan Baran
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -296,7 +296,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
296
296
|
requirements:
|
297
297
|
- - ">="
|
298
298
|
- !ruby/object:Gem::Version
|
299
|
-
version: '
|
299
|
+
version: '2.1'
|
300
300
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
301
301
|
requirements:
|
302
302
|
- - ">="
|