occi-cli 4.3.4 → 4.3.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: 3ed4fdb3246ce1cf2f09791a0cdb34102cdbac4f
4
- data.tar.gz: 66cf0cdcf5d6c519357c834ab78b3f49bd3de419
3
+ metadata.gz: 39502c62d6a033b34cabcf442032b7635fb98df7
4
+ data.tar.gz: 0a3f0bfa74eca163676ebadf446392ee0bc82b2d
5
5
  SHA512:
6
- metadata.gz: 30499156112eb63ba71a600aed6b689a15a3fc71211754e8193b7ed74e8cc76bec4c3cf36aec7eee275134ec30bbf389721ebc8b81a59926b71570e8d876b5b1
7
- data.tar.gz: 856b1f6728377740a504adc2c01a4b0b02218b97a221b19f4e1ea1cd55240a0eb3934fa6297b9c72c3673a90bcbf859973de7944c293f0f70c912d002b759fc6
6
+ metadata.gz: 6f997d695d5621b74f7522d96b5b95e212bc4b9a2c30ee499fc564654655fbe107dc69730f256cfaa70616e606e429c2521242f72c9dcbd66eb9b7ecac8fb332
7
+ data.tar.gz: 476c7fc25ca9d74fc902d88ddaf813f6b50d87582dbda51afcb79ff70527a5a49b7162fdfdc85618acca516894ae02e996c50c354a049cec6ee2d200cd9714ba
data/Gemfile CHANGED
@@ -1,14 +1,3 @@
1
1
  source "https://rubygems.org/"
2
2
 
3
3
  gemspec
4
-
5
- group :development do
6
- gem 'warbler', :git => 'git://github.com/jruby/warbler.git', :ref => 'ce3ce4df137504822e4cbb9399dee7e7dd767c44'
7
- gem 'rubygems-tasks', :git => 'git://github.com/postmodern/rubygems-tasks.git'
8
- gem "rspec"
9
- gem "rake"
10
- gem "builder"
11
- gem "simplecov"
12
- gem "yard"
13
- gem "yard-rspec"
14
- end
data/lib/occi-cli.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'occi-api'
3
+ require 'timeout'
3
4
 
4
5
  module Occi::Cli; end
5
6
 
@@ -1,5 +1,7 @@
1
1
  module Occi::Cli::Helpers::CreateHelper
2
2
 
3
+ MIN_TIMEOUT = 5
4
+
3
5
  def helper_create(options, output = nil)
4
6
  location = nil
5
7
 
@@ -43,8 +45,25 @@ module Occi::Cli::Helpers::CreateHelper
43
45
  #res.check
44
46
 
45
47
  Occi::Cli::Log.debug "Creating #{options.resource.inspect}: #{res.inspect}"
48
+ new_link = create(res)
49
+ helper_create_wait(new_link, options.wait_for_active) if options.wait_for_active > 0
50
+
51
+ new_link
52
+ end
46
53
 
47
- create res
54
+ def helper_create_wait(resource_link, timeout)
55
+ begin
56
+ Timeout::timeout(timeout) {
57
+ Occi::Cli::Log.debug "Starting #{timeout}s wait period for #{resource_link.inspect} to become active"
58
+ while true
59
+ desrc = describe(resource_link).first
60
+ break if !desrc.respond_to?(:state) || desrc.state == 'active'
61
+ sleep MIN_TIMEOUT
62
+ end
63
+ }
64
+ rescue Timeout::Error
65
+ Occi::Cli::Log.warn "Attempted to wait #{timeout}s for #{resource_link.inspect} to become active"
66
+ end
48
67
  end
49
68
 
50
69
  def helper_create_attach_links(options, res)
@@ -240,6 +240,14 @@ module Occi::Cli
240
240
  end
241
241
  end
242
242
 
243
+ opts.on("-w",
244
+ "--wait-for-active TIMEOUT",
245
+ Integer,
246
+ "Wait for TIMEOUT seconds for the created resource to become 'active' before returning, " \
247
+ "defaults to 0 seconds (will be interpreted as 'disabled')") do |wait_for_active|
248
+ options.wait_for_active = wait_for_active
249
+ end
250
+
243
251
  opts.on_tail("-z",
244
252
  "--examples",
245
253
  "Show usage examples") do |examples|
@@ -329,6 +337,7 @@ module Occi::Cli
329
337
 
330
338
  options.endpoint = "http://localhost:3000"
331
339
  options.timeout = nil
340
+ options.wait_for_active = 0
332
341
 
333
342
  options.auth = {}
334
343
  options.auth.type = "none"
@@ -1,5 +1,5 @@
1
1
  module Occi
2
2
  module Cli
3
- VERSION = "4.3.4" unless defined?(::Occi::Cli::VERSION)
3
+ VERSION = "4.3.5" unless defined?(::Occi::Cli::VERSION)
4
4
  end
5
5
  end
data/occi-cli.gemspec CHANGED
@@ -23,5 +23,13 @@ Gem::Specification.new do |gem|
23
23
  gem.add_dependency 'json', '~> 1.8', '>= 1.8.1'
24
24
  gem.add_dependency 'highline', '~> 1.6', '>= 1.6.21'
25
25
 
26
+ gem.add_development_dependency 'bundler', '~> 1.12'
27
+ gem.add_development_dependency 'rake', '~> 11.0'
28
+ gem.add_development_dependency 'rspec', '~> 3.4'
29
+ gem.add_development_dependency 'simplecov', '~> 0.11'
30
+ gem.add_development_dependency 'pry', '~> 0.10'
31
+ gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
32
+ gem.add_development_dependency 'yard', '~> 0.8'
33
+
26
34
  gem.required_ruby_version = ">= 1.9.3"
27
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.4
4
+ version: 4.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Feldhaus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-24 00:00:00.000000000 Z
13
+ date: 2016-11-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: occi-api
@@ -72,6 +72,104 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 1.6.21
75
+ - !ruby/object:Gem::Dependency
76
+ name: bundler
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.12'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.12'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rake
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '11.0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '11.0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.4'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '3.4'
117
+ - !ruby/object:Gem::Dependency
118
+ name: simplecov
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.11'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.11'
131
+ - !ruby/object:Gem::Dependency
132
+ name: pry
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '0.10'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '0.10'
145
+ - !ruby/object:Gem::Dependency
146
+ name: rubygems-tasks
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '0.2'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '0.2'
159
+ - !ruby/object:Gem::Dependency
160
+ name: yard
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '0.8'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '0.8'
75
173
  description: This gem is a client implementation of the Open Cloud Computing Interface
76
174
  in Ruby
77
175
  email:
@@ -145,8 +243,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
243
  version: '0'
146
244
  requirements: []
147
245
  rubyforge_project:
148
- rubygems_version: 2.4.6
246
+ rubygems_version: 2.4.8
149
247
  signing_key:
150
248
  specification_version: 4
151
249
  summary: Executable OCCI client
152
- test_files: []
250
+ test_files:
251
+ - spec/occi/cli/helpers_spec.rb
252
+ - spec/occi/cli/occi_opts_spec.rb
253
+ - spec/occi/cli/resource_output_factory_spec.rb
254
+ - spec/spec_helper.rb