nifty 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5591b23e043bc9d838800912365f1bcd58b048fa
4
- data.tar.gz: 9d0e05448b444852afd7270c9bfdf951338afab9
3
+ metadata.gz: 5cdc153b695c7aff6d7f455493d363fff9e25b86
4
+ data.tar.gz: 391b28158089f86dadd7d65afd043f5ccd688401
5
5
  SHA512:
6
- metadata.gz: 26b0ccf1af50d091ce7d7145c747fd7df1b3f9a8eeb63402dfbd71ed244775e11bb083c40e91c194d58e58275b3065e4bf255bb44931be3e853543419f4c1d7d
7
- data.tar.gz: 59641bfa248ac314da3ec51bb226a6fb81daee88a8f6ba491dfe525c1d43462af10c1901a94443884f5e798f1237c32779f079f7de05ee49b3c843ba93c3e573
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 # Lists all available backends with their description
68
- nifty help [COMMAND] # Describe available commands or one specific command
69
- nifty opennebula --expiration-interval=EXPIRATION-INTERVAL -d, --datastores=one two three # Runs NIFTY with backend opennebula
70
- nifty opennebula-transfer-methods # Lists all available transfer methods with their description for opennebula backend
71
- nifty version # Prints NIFTY's 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[:"expiration-interval"])
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::API_CALL_TIMEOUT) do
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::API_CALL_TIMEOUT) do
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::API_CALL_TIMEOUT) do
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::API_CALL_TIMEOUT) do
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
@@ -1,3 +1,3 @@
1
1
  module Nifty
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/nifty.rb CHANGED
@@ -2,8 +2,6 @@
2
2
  module Nifty
3
3
  GEM_DIR = File.realdirpath(File.join(File.dirname(__FILE__), '..'))
4
4
  APPLIANCE_SCHEMA = File.join(GEM_DIR, 'schema', 'appliance.json')
5
- API_CALL_TIMEOUT = 60
6
- API_POLLING_WAIT = 5
7
5
  end
8
6
 
9
7
  require 'active_support/all'
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
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-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler