nifty 0.2.4 → 0.2.5
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/README.md +7 -7
- data/config/nifty.yml +1 -0
- data/lib/nifty/backends/opennebula.rb +7 -1
- data/lib/nifty/backends/utils/opennebula/handler.rb +2 -0
- data/lib/nifty/backends/utils/opennebula/image_handler.rb +6 -6
- data/lib/nifty/backends/utils/opennebula/template_handler.rb +2 -2
- data/lib/nifty/version.rb +1 -1
- data/lib/nifty.rb +0 -2
- 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: 5cdc153b695c7aff6d7f455493d363fff9e25b86
|
4
|
+
data.tar.gz: 391b28158089f86dadd7d65afd043f5ccd688401
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7975505c83737b902cb1c1aba634c842e19c96fa2c3eb998c7a2807ec3160ed2e90a0fc844db911ac7828f5331ff7af7490d3cda6393d9b49c09c555260fd776
|
7
|
+
data.tar.gz: ea370f4d5d5d872423eb84a111601e7614d3724ba4aa26f34c03244b93349b4c2f79fed015d171271535d8714c8cf67519ece310dc6a70d2c71f1414f9a650d2
|
data/README.md
CHANGED
@@ -64,11 +64,11 @@ NIFTY is run with executable `nifty`. For further assistance run `nifty help`:
|
|
64
64
|
$ nifty help
|
65
65
|
|
66
66
|
Commands:
|
67
|
-
nifty backends
|
68
|
-
nifty help [COMMAND]
|
69
|
-
nifty opennebula --expiration-interval=EXPIRATION-INTERVAL -d, --datastores=one two three # Runs NIFTY with backend opennebula
|
70
|
-
nifty opennebula-transfer-methods
|
71
|
-
nifty version
|
67
|
+
nifty backends # Lists all available backends with their description
|
68
|
+
nifty help [COMMAND] # Describe available commands or one specific command
|
69
|
+
nifty opennebula --api-call-timeout=API-CALL-TIMEOUT --expiration-interval=EXPIRATION-INTERVAL --permissions=PERMISSIONS -d, --datastores=one two three # Runs NIFTY with backend opennebula
|
70
|
+
nifty opennebula-transfer-methods # Lists all available transfer methods with their description for "...
|
71
|
+
nifty version # Prints NIFTY's version
|
72
72
|
|
73
73
|
Options:
|
74
74
|
-a, --appliance-dir=APPLIANCE-DIR # Directory from where appliance descriptors will be loaded
|
@@ -85,12 +85,13 @@ OpenNebula is currently the only supported backend for NIFTY. NIFTY can upload a
|
|
85
85
|
$ nifty help opennebula
|
86
86
|
|
87
87
|
Usage:
|
88
|
-
nifty opennebula --expiration-interval=EXPIRATION-INTERVAL -d, --datastores=one two three
|
88
|
+
nifty opennebula --api-call-timeout=API-CALL-TIMEOUT --expiration-interval=EXPIRATION-INTERVAL --permissions=PERMISSIONS -d, --datastores=one two three
|
89
89
|
|
90
90
|
Options:
|
91
91
|
[--secret=SECRET] # Pair of username and password in form of 'username:password' for accessing OpenNebula
|
92
92
|
[--endpoint=ENDPOINT] # OpenNebula's XML RPC endpoint
|
93
93
|
--expiration-interval=EXPIRATION-INTERVAL # How long should expired images be kept in OpenNebula befor removal, 0 means don't remove
|
94
|
+
--api-call-timeout=API-CALL-TIMEOUT # How long will NIFTY wait for image/template operations to finish in OpenNebula
|
94
95
|
-d, --datastores=one two three # Names of OpenNebula datastores images will be uploaded to
|
95
96
|
[--template-dir=TEMPLATE-DIR] # If set, templates within this directory are used to construct images and templates in OpenNebula
|
96
97
|
[--description-naming], [--no-description-naming] # If true, uses identifier and version from appliance description as template/image name instead of generated uuids
|
@@ -100,7 +101,6 @@ Options:
|
|
100
101
|
-a, --appliance-dir=APPLIANCE-DIR # Directory from where appliance descriptors will be loaded
|
101
102
|
-m, --transfer-method=TRANSFER-METHOD # Transfer method for image upload
|
102
103
|
-t, [--transfer-destination=TRANSFER-DESTINATION] # Image upload destination
|
103
|
-
-b, --backend=BACKEND # Backend for registering images
|
104
104
|
--logging-level=LOGGING-LEVEL
|
105
105
|
[--logging-file=LOGGING-FILE] # File to write log to
|
106
106
|
[--debug], [--no-debug] # Runs nifty in debug mode
|
data/config/nifty.yml
CHANGED
@@ -9,6 +9,7 @@ production:
|
|
9
9
|
datastores: # Array of names of OpenNebula datastores images will be uploaded to. Has to contain at least one datastore if opennebula backend is selected
|
10
10
|
- default
|
11
11
|
expiration-interval: 2w # How long should expired images be kept in OpenNebula before removal, 0 means don't remove
|
12
|
+
api-call-timeout: 3h # How long will NIFTY wait for image/template operations to finish in OpenNebula
|
12
13
|
template-dir: # If set, templates within this directory are used to construct images and templates in OpenNebula
|
13
14
|
description-naming: false # If true, uses identifier and version from appliance description as template/image name instead of generated uuids
|
14
15
|
disk-expiration: true # Will expire old disks before the new one is registered
|
@@ -30,6 +30,11 @@ class Nifty::Backends::Opennebula < Nifty::Backend
|
|
30
30
|
:type => :string,
|
31
31
|
:desc => 'How long should expired images be kept in OpenNebula befor removal, 0 means don\'t remove'
|
32
32
|
},
|
33
|
+
:"api-call-timeout" => {
|
34
|
+
:required => true,
|
35
|
+
:type => :string,
|
36
|
+
:desc => 'How long will NIFTY wait for image/template operations to finish in OpenNebula'
|
37
|
+
},
|
33
38
|
:datastores => {
|
34
39
|
:required => true,
|
35
40
|
:type => :array,
|
@@ -63,6 +68,7 @@ class Nifty::Backends::Opennebula < Nifty::Backend
|
|
63
68
|
|
64
69
|
# @see Nifty::Backend#pre
|
65
70
|
def pre(parameters)
|
71
|
+
Nifty::Backends::Utils::Opennebula::Handler.api_call_timeout = ChronicDuration.parse(parameters[:'api-call-timeout'], keep_zero: true)
|
66
72
|
expiration_check(parameters)
|
67
73
|
end
|
68
74
|
|
@@ -89,7 +95,7 @@ class Nifty::Backends::Opennebula < Nifty::Backend
|
|
89
95
|
# @option parameters [String] secret OpenNebula's secret
|
90
96
|
# @option parameters [String] endpoint OpenNebula's endpoint
|
91
97
|
def expiration_check(parameters)
|
92
|
-
interval = ChronicDuration.parse(parameters[:
|
98
|
+
interval = ChronicDuration.parse(parameters[:'expiration-interval'])
|
93
99
|
return unless interval
|
94
100
|
|
95
101
|
client = Nifty::Backends::Utils::Opennebula::Helper.client(parameters[:secret], parameters[:endpoint])
|
@@ -7,11 +7,13 @@
|
|
7
7
|
class Nifty::Backends::Utils::Opennebula::Handler
|
8
8
|
attr_reader :client
|
9
9
|
attr_accessor :pool
|
10
|
+
cattr_accessor :api_call_timeout
|
10
11
|
|
11
12
|
ONEADMIN_ID = 0
|
12
13
|
LEAVE_AS_IS = -1
|
13
14
|
ATTRIBUTE_APPLIANCE_ID = 'NIFTY_APPLIANCE_ID'
|
14
15
|
OWNER_OCTET = '600'
|
16
|
+
API_POLLING_WAIT = 10
|
15
17
|
|
16
18
|
# Constructor
|
17
19
|
#
|
@@ -75,9 +75,9 @@ class Nifty::Backends::Utils::Opennebula::ImageHandler < Nifty::Backends::Utils:
|
|
75
75
|
logger.debug("Deleting image with id #{id.inspect}")
|
76
76
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { image.delete }
|
77
77
|
|
78
|
-
Timeout::timeout(Nifty::
|
78
|
+
Timeout::timeout(Nifty::Backends::Utils::Opennebula::Handler.api_call_timeout) do
|
79
79
|
while(image_exist?(id))
|
80
|
-
sleep(Nifty::API_POLLING_WAIT)
|
80
|
+
sleep(Nifty::Backends::Utils::Opennebula::Handler::API_POLLING_WAIT)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
rescue Timeout::Error
|
@@ -105,9 +105,9 @@ class Nifty::Backends::Utils::Opennebula::ImageHandler < Nifty::Backends::Utils:
|
|
105
105
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { image.disable }
|
106
106
|
|
107
107
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { image.info! }
|
108
|
-
Timeout::timeout(Nifty::
|
108
|
+
Timeout::timeout(Nifty::Backends::Utils::Opennebula::Handler.api_call_timeout) do
|
109
109
|
until(image.state_str == IMAGE_STATE_DISABLED)
|
110
|
-
sleep(Nifty::API_POLLING_WAIT)
|
110
|
+
sleep(Nifty::Backends::Utils::Opennebula::Handler::API_POLLING_WAIT)
|
111
111
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { image.info! }
|
112
112
|
end
|
113
113
|
end
|
@@ -171,11 +171,11 @@ class Nifty::Backends::Utils::Opennebula::ImageHandler < Nifty::Backends::Utils:
|
|
171
171
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { image.allocate(template, datastore.id) }
|
172
172
|
|
173
173
|
begin
|
174
|
-
Timeout::timeout(Nifty::
|
174
|
+
Timeout::timeout(Nifty::Backends::Utils::Opennebula::Handler.api_call_timeout) do
|
175
175
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { image.info! }
|
176
176
|
|
177
177
|
until(image.state_str == IMAGE_STATE_READY)
|
178
|
-
sleep(Nifty::API_POLLING_WAIT)
|
178
|
+
sleep(Nifty::Backends::Utils::Opennebula::Handler::API_POLLING_WAIT)
|
179
179
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { image.info! }
|
180
180
|
end
|
181
181
|
end
|
@@ -47,9 +47,9 @@ class Nifty::Backends::Utils::Opennebula::TemplateHandler < Nifty::Backends::Uti
|
|
47
47
|
logger.debug("Deleting template with id #{id.inspect}")
|
48
48
|
Nifty::Backends::Utils::Opennebula::Helper.handle_opennebula_error { template.delete }
|
49
49
|
|
50
|
-
Timeout::timeout(Nifty::
|
50
|
+
Timeout::timeout(Nifty::Backends::Utils::Opennebula::Handler.api_call_timeout) do
|
51
51
|
while(template_exist?(id))
|
52
|
-
sleep(Nifty::API_POLLING_WAIT)
|
52
|
+
sleep(Nifty::Backends::Utils::Opennebula::Handler::API_POLLING_WAIT)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
rescue Timeout::Error
|
data/lib/nifty/version.rb
CHANGED
data/lib/nifty.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nifty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Kimle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|