occi-cli 4.3.8 → 4.3.9
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/bin/occi +2 -0
- data/lib/occi/cli/helpers.rb +1 -0
- data/lib/occi/cli/helpers/trigger_helper.rb +7 -5
- data/lib/occi/cli/helpers/update_helper.rb +34 -0
- data/lib/occi/cli/occi_opts.rb +5 -1
- data/lib/occi/cli/version.rb +1 -1
- data/occi-cli.gemspec +2 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d514c601aafd16b93f02d405c5a6040fd1d6cc65
|
4
|
+
data.tar.gz: 5d5ed74ecc16de22e0162183cade0f6880313001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 740921fa7ba5e6b0bb0dc93ddba8f890a7a94766128295655247da436e7986c83d8c1f092318de2e5f44f8966468601e899c79af3619c79c675ef606aedcc771
|
7
|
+
data.tar.gz: dae114bc9c927dc6bb91d30f1a404aa0e61f2e2eeac4e47db85e2498be9bdb063727686bc097d1ac308614876af41ba83ef12a498cc29cef44b4b00b02690bbd
|
data/bin/occi
CHANGED
data/lib/occi/cli/helpers.rb
CHANGED
@@ -12,14 +12,16 @@ module Occi::Cli::Helpers::TriggerHelper
|
|
12
12
|
action_instance.action = helper_trigger_normalize_action(options.trigger_action)
|
13
13
|
action_instance.attributes = options.attributes
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
"triggered on #{options.resource.inspect}!"
|
18
|
-
else
|
15
|
+
res = trigger(options.resource, action_instance)
|
16
|
+
unless res
|
19
17
|
message = "Failed to trigger an action on #{options.resource.inspect}!"
|
20
18
|
Occi::Cli::Log.error message
|
21
19
|
raise message
|
22
20
|
end
|
21
|
+
Occi::Cli::Log.info "Action #{options.trigger_action.type_identifier.inspect} " \
|
22
|
+
"triggered on #{options.resource.inspect}!"
|
23
|
+
return res unless output
|
24
|
+
puts output.format(res.to_a.collect { |m| m.type_identifier }) if res.kind_of? Occi::Core::Mixins
|
23
25
|
|
24
26
|
true
|
25
27
|
end
|
@@ -41,4 +43,4 @@ module Occi::Cli::Helpers::TriggerHelper
|
|
41
43
|
action
|
42
44
|
end
|
43
45
|
|
44
|
-
end
|
46
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Occi::Cli::Helpers::UpdateHelper
|
2
|
+
def helper_update(options, output = nil)
|
3
|
+
unless resource_types.include?(options.resource) || resource_type_identifiers.include?(options.resource) \
|
4
|
+
|| \
|
5
|
+
options.resource.start_with?(options.endpoint) || options.resource.start_with?('/')
|
6
|
+
Occi::Cli::Log.error "I have no idea what #{options.resource.inspect} is ..."
|
7
|
+
raise "Unknown resource #{options.resource.inspect}, there is nothing to update here!"
|
8
|
+
end
|
9
|
+
|
10
|
+
raise "No updatable mixins were provided!" if options.mixins.blank?
|
11
|
+
mxns = ::Occi::Core::Mixins.new
|
12
|
+
options.mixins.to_a.each do |mxn|
|
13
|
+
Occi::Cli::Log.debug "Adding mixin #{mxn.inspect} to #{options.resource.inspect}"
|
14
|
+
|
15
|
+
orig_mxn = model.get_by_id(mxn.type_identifier)
|
16
|
+
if orig_mxn.blank?
|
17
|
+
orig_mxn = mixin(mxn.term, mxn.scheme.chomp('#'), true)
|
18
|
+
raise Occi::Cli::Errors::MixinLookupError,
|
19
|
+
"The specified mixin is not declared in the model! #{mxn.type_identifier.inspect}" if orig_mxn.blank?
|
20
|
+
end
|
21
|
+
|
22
|
+
mxns << orig_mxn
|
23
|
+
end
|
24
|
+
|
25
|
+
unless update(options.resource, mxns)
|
26
|
+
message = "Failed to update #{options.resource.inspect}!"
|
27
|
+
Occi::Cli::Log.error message
|
28
|
+
raise message
|
29
|
+
end
|
30
|
+
Occi::Cli::Log.info "Update performed on #{options.resource.inspect}!"
|
31
|
+
|
32
|
+
true
|
33
|
+
end
|
34
|
+
end
|
data/lib/occi/cli/occi_opts.rb
CHANGED
@@ -11,7 +11,7 @@ module Occi::Cli
|
|
11
11
|
|
12
12
|
AUTH_METHODS = [:x509, :token, :basic, :digest, :none].freeze
|
13
13
|
MEDIA_TYPES = ["application/occi+json", "text/plain,text/occi", "text/plain", "text/occi"].freeze
|
14
|
-
ACTIONS = [:list, :describe, :create, :delete, :trigger, :link, :unlink, :discover].freeze
|
14
|
+
ACTIONS = [:list, :describe, :create, :delete, :trigger, :link, :unlink, :discover, :update].freeze
|
15
15
|
LOG_OUTPUTS = [:stdout, :stderr].freeze
|
16
16
|
LOG_LEVELS = [:debug, :error, :fatal, :info, :unknown, :warn].freeze
|
17
17
|
ENTITY_TYPES = [:resource, :link].freeze
|
@@ -419,6 +419,10 @@ module Occi::Cli
|
|
419
419
|
mandatory.concat [:resource, :action]
|
420
420
|
end
|
421
421
|
|
422
|
+
if options.action == :update
|
423
|
+
mandatory << :mixins
|
424
|
+
end
|
425
|
+
|
422
426
|
mandatory
|
423
427
|
end
|
424
428
|
|
data/lib/occi/cli/version.rb
CHANGED
data/occi-cli.gemspec
CHANGED
@@ -19,13 +19,13 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
|
22
|
-
gem.add_dependency 'occi-api', '>= 4.3.
|
22
|
+
gem.add_dependency 'occi-api', '>= 4.3.11', '< 5'
|
23
23
|
gem.add_dependency 'json', '>= 1.8.1', '< 3'
|
24
24
|
gem.add_dependency 'highline', '>= 1.6.21', '< 2'
|
25
25
|
gem.add_dependency 'activesupport', '>= 4.0.0', '< 5'
|
26
26
|
|
27
27
|
gem.add_development_dependency 'bundler', '>= 1.12', '< 2'
|
28
|
-
gem.add_development_dependency 'rubygems-tasks', '>= 0.2.4', '<
|
28
|
+
gem.add_development_dependency 'rubygems-tasks', '>= 0.2.4', '< 0.3'
|
29
29
|
gem.add_development_dependency 'rspec', '>= 3.5.0', '< 4'
|
30
30
|
gem.add_development_dependency 'rake', '>= 12', '< 13'
|
31
31
|
gem.add_development_dependency 'simplecov', '>= 0.13', '< 1'
|
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
|
+
version: 4.3.9
|
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: 2017-
|
13
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: occi-api
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.3.
|
21
|
+
version: 4.3.11
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: '5'
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 4.3.
|
31
|
+
version: 4.3.11
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '5'
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
version: 0.2.4
|
122
122
|
- - "<"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0.3'
|
125
125
|
type: :development
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: 0.2.4
|
132
132
|
- - "<"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: '
|
134
|
+
version: '0.3'
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: rspec
|
137
137
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,6 +290,7 @@ files:
|
|
290
290
|
- lib/occi/cli/helpers/link_helper.rb
|
291
291
|
- lib/occi/cli/helpers/list_helper.rb
|
292
292
|
- lib/occi/cli/helpers/trigger_helper.rb
|
293
|
+
- lib/occi/cli/helpers/update_helper.rb
|
293
294
|
- lib/occi/cli/log.rb
|
294
295
|
- lib/occi/cli/occi_opts.rb
|
295
296
|
- lib/occi/cli/occi_opts/cli_examples.erb
|
@@ -325,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
325
326
|
version: '0'
|
326
327
|
requirements: []
|
327
328
|
rubyforge_project:
|
328
|
-
rubygems_version: 2.
|
329
|
+
rubygems_version: 2.4.8
|
329
330
|
signing_key:
|
330
331
|
specification_version: 4
|
331
332
|
summary: Executable OCCI client
|