occi-cli 4.2.0.beta.8 → 4.2.0.beta.10
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 +5 -13
- data/.travis.yml +6 -0
- data/lib/occi/cli/helpers/trigger_helper.rb +38 -1
- data/lib/occi/cli/occi_opts/occi_opts_helper.rb +11 -7
- data/lib/occi/cli/occi_opts.rb +12 -12
- data/lib/occi/cli/version.rb +1 -1
- data/occi-cli.gemspec +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDNjOTJjMjNmZjU1NTE3NjhiNmNkMDgzYzZkNWIwZTZjOTFlNWI5OA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 07c20aa7d78d97f71d38b5864e8171f87518cd28
|
4
|
+
data.tar.gz: 6d71a666b9d39ccd5bc5c83777131743c723bf9c
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZGJiMDU5ODE3MjlkNzAzOWI3Njg1OTk2NWZkYWJlODMwNTg1N2FiYmViODAx
|
11
|
-
Zjg2NDRjMDM0MDBjYzhlZTliZjJiYzZkYjY0MzRhNjljNDU2ZTg=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTFjZTUyZTU1NWMzMjljMzE0NTk4NzIzMWY3MzM1MGRlNTlkOGJkNjQyNmE0
|
14
|
-
OTNiNGFhNzIyZGU0NDBkZTdjMzEwMjU3NTlkNWY5Yzc3Nzg4MzJkZjM5ZGM3
|
15
|
-
ZjgwY2E3ZDgyNWNmOTA5ZTk3YmI2NTZiNWE0YTFlYTFjNmQwOWE=
|
6
|
+
metadata.gz: ac651f1a84eb8a2266ad2f49398a95b683016b0a5610f75f168165784ec660d1a7c2b76f60295f5e1ec01e29d3feae0c54554fb23e1c60e240b9f1ffd7116e73
|
7
|
+
data.tar.gz: 03eb7bd97cb212d3f289f4806a78f0a4286bd6a04ecb71a2681afb9b1cbf9923d7e10ee45f263c8b4e17b1e5107dec9a22da06bcb4b4eccc25239dbfa2e0ccbe
|
data/.travis.yml
CHANGED
@@ -3,6 +3,7 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 1.9.3
|
5
5
|
- 2.0.0
|
6
|
+
- 2.1.0
|
6
7
|
- ruby-head
|
7
8
|
- jruby-19mode
|
8
9
|
- jruby-head
|
@@ -25,10 +26,15 @@ matrix:
|
|
25
26
|
jdk: openjdk7
|
26
27
|
- rvm: 2.0.0
|
27
28
|
jdk: oraclejdk7
|
29
|
+
- rvm: 2.1.0
|
30
|
+
jdk: openjdk7
|
31
|
+
- rvm: 2.1.0
|
32
|
+
jdk: oraclejdk7
|
28
33
|
- rvm: ruby-head
|
29
34
|
jdk: openjdk7
|
30
35
|
- rvm: ruby-head
|
31
36
|
jdk: oraclejdk7
|
37
|
+
fast_finish: true
|
32
38
|
|
33
39
|
branches:
|
34
40
|
only:
|
@@ -1,7 +1,44 @@
|
|
1
1
|
module Occi::Cli::Helpers::TriggerHelper
|
2
2
|
|
3
3
|
def helper_trigger(options, output = nil)
|
4
|
-
|
4
|
+
unless resource_types.include?(options.resource) || resource_type_identifiers.include?(options.resource) \
|
5
|
+
|| \
|
6
|
+
options.resource.start_with?(options.endpoint) || options.resource.start_with?('/')
|
7
|
+
Occi::Log.error "I have no idea what #{options.resource.inspect} is ..."
|
8
|
+
raise "Unknown resource #{options.resource.inspect}, there is nothing to trigger here!"
|
9
|
+
end
|
10
|
+
|
11
|
+
action_instance = Occi::Core::ActionInstance.new
|
12
|
+
action_instance.action = helper_trigger_normalize_action(options.trigger_action)
|
13
|
+
action_instance.attributes = options.attributes
|
14
|
+
|
15
|
+
if trigger(options.resource, action_instance)
|
16
|
+
Occi::Log.info "Action #{options.trigger_action.action.type_identifier.inspect} " \
|
17
|
+
"triggered on #{options.resource.inspect}!"
|
18
|
+
else
|
19
|
+
message = "Failed to trigger an action on #{options.resource.inspect}!"
|
20
|
+
Occi::Log.error message
|
21
|
+
raise message
|
22
|
+
end
|
23
|
+
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def helper_trigger_normalize_action(action)
|
28
|
+
return action if action_type_identifiers.include?(action.type_identifier)
|
29
|
+
|
30
|
+
ti = action_type_identifier(action.term)
|
31
|
+
if ti.blank?
|
32
|
+
message = "Failed to identify action #{action.type_identifier.inspect} in the model!"
|
33
|
+
Occi::Log.error message
|
34
|
+
raise message
|
35
|
+
end
|
36
|
+
|
37
|
+
splt = ti.split '#'
|
38
|
+
action.term = splt.last
|
39
|
+
action.scheme = "#{splt.first}#"
|
40
|
+
|
41
|
+
action
|
5
42
|
end
|
6
43
|
|
7
44
|
end
|
@@ -6,7 +6,7 @@ module Occi::Cli
|
|
6
6
|
|
7
7
|
ALLOWED_CONTEXT_VARS = [:public_key, :user_data].freeze
|
8
8
|
|
9
|
-
MIXIN_REGEXP =
|
9
|
+
MIXIN_REGEXP = /^(\S+?)#(\S+)$/
|
10
10
|
CONTEXT_REGEXP = ATTR_REGEXP = /^(\S+?)=(.+)$/
|
11
11
|
|
12
12
|
ATTR_NUM_EXP = /num\((?<number>\d+)\)/
|
@@ -27,7 +27,7 @@ module Occi::Cli
|
|
27
27
|
|
28
28
|
context_data = ary[1]
|
29
29
|
if context_data.gsub!(/^file:\/\//,'')
|
30
|
-
raise
|
30
|
+
raise "File does not exist! #{context_data.inspect}" unless File.exist? context_data
|
31
31
|
context_data = File.read(context_data)
|
32
32
|
end
|
33
33
|
|
@@ -42,7 +42,7 @@ module Occi::Cli
|
|
42
42
|
ary = ATTR_REGEXP.match(attribute).to_a.drop 1
|
43
43
|
raise ArgumentError, "Attribute must always contain ATTR=VALUE pairs!" unless ary.length == 2
|
44
44
|
|
45
|
-
|
45
|
+
# type-cast the value, if necessary
|
46
46
|
ary[1] = parse_attribute_value(ary[1])
|
47
47
|
|
48
48
|
ary
|
@@ -50,16 +50,20 @@ module Occi::Cli
|
|
50
50
|
|
51
51
|
def self.parse_mixin(mixin)
|
52
52
|
parts = MIXIN_REGEXP.match(mixin).to_a.drop(1)
|
53
|
-
raise "Unknown mixin format
|
53
|
+
raise "Unknown mixin format #{mixin.inspect}! Use SCHEME#TERM or SHORT_SCHEME#TERM!" unless parts.length == 2
|
54
54
|
|
55
55
|
Occi::Core::Mixin.new("#{parts[0]}#", parts[1])
|
56
56
|
end
|
57
57
|
|
58
58
|
def self.parse_action(action)
|
59
|
-
|
60
|
-
|
59
|
+
raise "Unknown action format #{action.inspect}! Use SCHEME#TERM or TERM!" if action.blank?
|
60
|
+
parts = action.split('#')
|
61
61
|
|
62
|
-
|
62
|
+
if parts.size == 2
|
63
|
+
Occi::Core::Action.new("#{parts[0]}#", parts[1])
|
64
|
+
else
|
65
|
+
Occi::Core::Action.new("action#", parts.last)
|
66
|
+
end
|
63
67
|
end
|
64
68
|
|
65
69
|
def self.parse_attribute_value(value)
|
data/lib/occi/cli/occi_opts.rb
CHANGED
@@ -33,7 +33,7 @@ module Occi::Cli
|
|
33
33
|
opts.on("-e",
|
34
34
|
"--endpoint URI",
|
35
35
|
String,
|
36
|
-
"OCCI server URI, defaults to
|
36
|
+
"OCCI server URI, defaults to #{options.endpoint.inspect}") do |endpoint|
|
37
37
|
options.endpoint = URI(endpoint).to_s
|
38
38
|
end
|
39
39
|
|
@@ -41,7 +41,7 @@ module Occi::Cli
|
|
41
41
|
"--auth METHOD",
|
42
42
|
AUTH_METHODS,
|
43
43
|
"Authentication method, only: [#{AUTH_METHODS.join('|')}], defaults " \
|
44
|
-
"to
|
44
|
+
"to #{options.auth.type.inspect}") do |auth|
|
45
45
|
options.auth.type = auth.to_s
|
46
46
|
end
|
47
47
|
|
@@ -49,7 +49,7 @@ module Occi::Cli
|
|
49
49
|
"--username USER",
|
50
50
|
String,
|
51
51
|
"Username for basic or digest authentication, defaults to " \
|
52
|
-
"
|
52
|
+
"#{options.auth.username.inspect}") do |username|
|
53
53
|
options.auth.username = username
|
54
54
|
end
|
55
55
|
|
@@ -64,7 +64,7 @@ module Occi::Cli
|
|
64
64
|
opts.on("-c",
|
65
65
|
"--ca-path PATH",
|
66
66
|
String,
|
67
|
-
"Path to CA certificates directory, defaults to
|
67
|
+
"Path to CA certificates directory, defaults to #{options.auth.ca_path.inspect}") do |ca_path|
|
68
68
|
raise ArgumentError, "Path specified in --ca-path is not a directory!" unless File.directory? ca_path
|
69
69
|
raise ArgumentError, "Path specified in --ca-path is not readable!" unless File.readable? ca_path
|
70
70
|
|
@@ -92,7 +92,7 @@ module Occi::Cli
|
|
92
92
|
opts.on("-x",
|
93
93
|
"--user-cred FILE",
|
94
94
|
String,
|
95
|
-
"Path to user's x509 credentials, defaults to
|
95
|
+
"Path to user's x509 credentials, defaults to #{options.auth.user_cert.inspect}") do |user_cred|
|
96
96
|
raise ArgumentError, "File specified in --user-cred is not a file!" unless File.file? user_cred
|
97
97
|
raise ArgumentError, "File specified in --user-cred is not readable!" unless File.readable? user_cred
|
98
98
|
|
@@ -110,7 +110,7 @@ module Occi::Cli
|
|
110
110
|
"--media-type MEDIA_TYPE",
|
111
111
|
MEDIA_TYPES,
|
112
112
|
"Media type for client <-> server communication, only: [#{MEDIA_TYPES.join('|')}], " \
|
113
|
-
"defaults to
|
113
|
+
"defaults to #{options.media_type.inspect}") do |media_type|
|
114
114
|
options.media_type = media_type
|
115
115
|
end
|
116
116
|
|
@@ -122,9 +122,9 @@ module Occi::Cli
|
|
122
122
|
end
|
123
123
|
|
124
124
|
opts.on("-t",
|
125
|
-
"--attribute
|
125
|
+
"--attribute ATTR",
|
126
126
|
Array,
|
127
|
-
"
|
127
|
+
"An \"attribute='value'\" pair, mandatory attrs for creating new resource instances: " \
|
128
128
|
"[#{REQ_CREATE_ATTRS.join(', ')}]") do |attributes|
|
129
129
|
options.attributes ||= Occi::Core::Attributes.new
|
130
130
|
|
@@ -135,9 +135,9 @@ module Occi::Cli
|
|
135
135
|
end
|
136
136
|
|
137
137
|
opts.on("-T",
|
138
|
-
"--context
|
138
|
+
"--context CTX_VAR",
|
139
139
|
Array,
|
140
|
-
"
|
140
|
+
"A \"context_variable='value'\" pair for new 'compute' resource instances, " \
|
141
141
|
"only: [#{Occi::Cli::OcciOpts::Helper::ALLOWED_CONTEXT_VARS.join(', ')}]") do |context|
|
142
142
|
options.context_vars ||= {}
|
143
143
|
|
@@ -181,7 +181,7 @@ module Occi::Cli
|
|
181
181
|
opts.on("-g",
|
182
182
|
"--trigger-action ACTION",
|
183
183
|
String,
|
184
|
-
"Action to be triggered on the resource, formatted as SCHEME#TERM or
|
184
|
+
"Action to be triggered on the resource, formatted as SCHEME#TERM or TERM") do |trigger_action|
|
185
185
|
options.trigger_action = Occi::Cli::OcciOpts::Helper.parse_action(trigger_action)
|
186
186
|
end
|
187
187
|
|
@@ -196,7 +196,7 @@ module Occi::Cli
|
|
196
196
|
"--output-format FORMAT",
|
197
197
|
Occi::Cli::ResourceOutputFactory.allowed_formats,
|
198
198
|
"Output format, only: [#{Occi::Cli::ResourceOutputFactory.allowed_formats.join('|')}], " \
|
199
|
-
"defaults to
|
199
|
+
"defaults to #{options.output_format.to_s.inspect}") do |output_format|
|
200
200
|
options.output_format = output_format
|
201
201
|
end
|
202
202
|
|
data/lib/occi/cli/version.rb
CHANGED
data/occi-cli.gemspec
CHANGED
@@ -19,7 +19,7 @@ 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.2.0.beta.
|
22
|
+
gem.add_dependency 'occi-api', '= 4.2.0.beta.10'
|
23
23
|
gem.add_dependency 'json'
|
24
24
|
gem.add_dependency 'highline'
|
25
25
|
|
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.2.0.beta.
|
4
|
+
version: 4.2.0.beta.10
|
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: 2014-01-
|
13
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: occi-api
|
@@ -18,40 +18,40 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.2.0.beta.
|
21
|
+
version: 4.2.0.beta.10
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 4.2.0.beta.
|
28
|
+
version: 4.2.0.beta.10
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: json
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - '>='
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: highline
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
description: This gem is a client implementation of the Open Cloud Computing Interface
|
@@ -112,12 +112,12 @@ require_paths:
|
|
112
112
|
- lib
|
113
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.9.3
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - '>'
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: 1.3.1
|
123
123
|
requirements: []
|