occi-cli 4.2.0.beta.7 → 4.2.0.beta.8
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 +8 -8
- data/lib/occi/cli/helpers/create_helper.rb +7 -4
- data/lib/occi/cli/helpers/describe_helper.rb +12 -1
- data/lib/occi/cli/helpers/link_helper.rb +8 -5
- data/lib/occi/cli/occi_opts/cli_examples.erb +70 -6
- data/lib/occi/cli/occi_opts.rb +2 -3
- data/lib/occi/cli/templates/mixins.erb +6 -6
- data/lib/occi/cli/templates/resources.erb +14 -13
- data/lib/occi/cli/version.rb +1 -1
- data/occi-cli.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGEwNjllMjkwNjhmZWM1N2RmNjNkNzRjYWZmM2FmODZlMTg2N2FjMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDNjOTJjMjNmZjU1NTE3NjhiNmNkMDgzYzZkNWIwZTZjOTFlNWI5OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjdkNmI5MWM1ZGIwMTI3ZjJjYjM1NWJiN2ZmYTEzYTA4MDZhM2I1MTE2ZGYw
|
10
|
+
ZGJiMDU5ODE3MjlkNzAzOWI3Njg1OTk2NWZkYWJlODMwNTg1N2FiYmViODAx
|
11
|
+
Zjg2NDRjMDM0MDBjYzhlZTliZjJiYzZkYjY0MzRhNjljNDU2ZTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTFjZTUyZTU1NWMzMjljMzE0NTk4NzIzMWY3MzM1MGRlNTlkOGJkNjQyNmE0
|
14
|
+
OTNiNGFhNzIyZGU0NDBkZTdjMzEwMjU3NTlkNWY5Yzc3Nzg4MzJkZjM5ZGM3
|
15
|
+
ZjgwY2E3ZDgyNWNmOTA5ZTk3YmI2NTZiNWE0YTFlYTFjNmQwOWE=
|
@@ -75,11 +75,14 @@ module Occi::Cli::Helpers::CreateHelper
|
|
75
75
|
options.mixins.to_a.each do |mxn|
|
76
76
|
Occi::Log.debug "Adding mixin #{mxn.inspect} to #{options.resource.inspect}"
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
orig_mxn = model.get_by_id(mxn.type_identifier)
|
79
|
+
if orig_mxn.blank?
|
80
|
+
orig_mxn = mixin(mxn.term, mxn.scheme.chomp('#'), true)
|
81
|
+
raise Occi::Cli::Errors::MixinLookupError,
|
82
|
+
"The specified mixin is not declared in the model! #{mxn.type_identifier.inspect}" if orig_mxn.blank?
|
83
|
+
end
|
81
84
|
|
82
|
-
res.mixins <<
|
85
|
+
res.mixins << orig_mxn
|
83
86
|
end
|
84
87
|
end
|
85
88
|
|
@@ -9,8 +9,19 @@ module Occi::Cli::Helpers::DescribeHelper
|
|
9
9
|
elsif mixin_types.include?(options.resource) || mixin_type_identifiers.include?(options.resource)
|
10
10
|
Occi::Log.debug "#{options.resource.inspect} is a mixin type or type identifier."
|
11
11
|
|
12
|
+
found = mixins(options.resource)
|
13
|
+
found = mixins(options.resource, true) if found.blank?
|
14
|
+
elsif options.resource.include?('#')
|
15
|
+
Occi::Log.debug "#{options.resource.inspect} might be a specific mixin identifier."
|
16
|
+
|
17
|
+
potential_mixin = options.resource.split('/').last.split('#')
|
18
|
+
raise "Given resource is not a specific mixin identifier! #{options.resource.inspect}" unless potential_mixin.size == 2
|
19
|
+
|
20
|
+
mxn = mixin(potential_mixin[1], potential_mixin[0], true)
|
21
|
+
raise "Given mixin could not be found in the model! #{options.resource.inspect}" if mxn.blank?
|
22
|
+
|
12
23
|
found = Occi::Core::Mixins.new
|
13
|
-
found
|
24
|
+
found << mxn
|
14
25
|
else
|
15
26
|
Occi::Log.error "I have no idea what #{options.resource.inspect} is ..."
|
16
27
|
raise "Unknown resource #{options.resource.inspect}, there is nothing to describe here!"
|
@@ -65,11 +65,14 @@ module Occi::Cli::Helpers::LinkHelper
|
|
65
65
|
mixins.to_a.each do |mxn|
|
66
66
|
Occi::Log.debug "Adding mixin #{mxn.inspect} to #{link.inspect}"
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
orig_mxn = model.get_by_id(mxn.type_identifier)
|
69
|
+
if orig_mxn.blank?
|
70
|
+
orig_mxn = mixin(mxn.term, mxn.scheme.chomp('#'), true)
|
71
|
+
raise Occi::Cli::Errors::MixinLookupError,
|
72
|
+
"The specified mixin is not declared in the model! #{mxn.type_identifier.inspect}" if orig_mxn.blank?
|
73
|
+
end
|
74
|
+
|
75
|
+
link.mixins << orig_mxn
|
73
76
|
end
|
74
77
|
end
|
75
78
|
|
@@ -1,11 +1,75 @@
|
|
1
|
-
|
1
|
+
<%- ENDPOINT = 'http://localhost:3000/' -%>
|
2
|
+
# Examples
|
2
3
|
|
3
|
-
|
4
|
+
## Quick reference guide
|
4
5
|
|
5
|
-
occi --endpoint
|
6
|
+
occi --endpoint <%= ENDPOINT -%> --action list --resource os_tpl
|
7
|
+
occi --endpoint <%= ENDPOINT -%> --action list --resource resource_tpl
|
8
|
+
occi --endpoint <%= ENDPOINT -%> --action describe --resource os_tpl#debian6
|
9
|
+
occi --endpoint <%= ENDPOINT -%> --action create --resource compute --mixin os_tpl#debian6 --mixin resource_tpl#small --attribute title="My rOCCI VM"
|
10
|
+
occi --endpoint <%= ENDPOINT -%> --action delete --resource /compute/65sd4f654sf65g4-s5fg65sfg465sfg-sf65g46sf5g4sdfg
|
6
11
|
|
7
|
-
|
12
|
+
## Listing resources
|
13
|
+
<% %w(compute network storage os_tpl resource_tpl).each do |res| %>
|
14
|
+
occi --endpoint <%= ENDPOINT -%> --action list --resource <%= res -%>
|
15
|
+
<% end %>
|
8
16
|
|
9
|
-
|
17
|
+
## Describing resources
|
18
|
+
<% %w(compute network storage os_tpl resource_tpl).each do |res| %>
|
19
|
+
occi --endpoint <%= ENDPOINT -%> --action describe --resource <%= res -%>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
## Creating resources
|
23
|
+
<% %w(compute network storage).each do |res| %>
|
24
|
+
occi --endpoint <%= ENDPOINT -%> --action create [ --attribute attribute_name='attribute_value' ]+ [ --mixin mixin_type#mixin_term ]+ --resource <%= res -%>
|
25
|
+
<% if res == 'compute' %>
|
26
|
+
occi --endpoint <%= ENDPOINT -%> --action create [ --attribute attribute_name='attribute_value' ]+ [ --link /resource_type/instance_id ]+ --resource <%= res -%>
|
27
|
+
<% end -%>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
## Linking/unlinking resources
|
31
|
+
<% %w(compute).each do |res| %>
|
32
|
+
<%- %w(network storage).each do |res_link| -%>
|
33
|
+
occi --endpoint <%= ENDPOINT -%> --action link --resource /<%= res -%>/instance_id --link /<%= res_link -%>/instance_id
|
34
|
+
<%- end -%>
|
35
|
+
<% end -%>
|
36
|
+
|
37
|
+
## Deleting resources
|
38
|
+
<% %w(compute network storage).each do |res| %>
|
39
|
+
occi --endpoint <%= ENDPOINT -%> --action delete --resource <%= res -%>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
## Triggering actions on resources
|
43
|
+
<% %w(compute network storage).each do |res| %>
|
44
|
+
occi --endpoint <%= ENDPOINT -%> --action trigger --trigger-action action_type#action_term [ --attribute attribute_name='attribute_value' ]+ --resource <%= res -%>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
## Other
|
48
|
+
|
49
|
+
### Authentication
|
50
|
+
|
51
|
+
occi --endpoint <%= ENDPOINT -%> [ --auth none ]
|
52
|
+
occi --endpoint <%= ENDPOINT -%> --auth basic [ --username user ] [ --password pass ]
|
53
|
+
occi --endpoint <%= ENDPOINT -%> --auth digest [ --username user ] [ --password pass ]
|
54
|
+
occi --endpoint <%= ENDPOINT -%> --auth x509 [ --user-cred /home/user/.globus/usercred.pem ] [ --ca-file /etc/grid-security/certificates/ca.pem ] [ --ca-path /etc/grid-security/certificates ] [ --voms ] [ --password pass ]
|
55
|
+
occi --endpoint <%= ENDPOINT -%> --auth x509 --user-cred /home/user/.globus/usercred.pem
|
56
|
+
occi --endpoint <%= ENDPOINT -%> --auth x509 --user-cred /tmp/x509_1000 --voms
|
57
|
+
occi --endpoint <%= ENDPOINT -%> --auth x509 --user-cred /tmp/x509_1000 --ca-path /etc/grid-security/certificates --voms
|
58
|
+
|
59
|
+
### Media types
|
60
|
+
<% Occi::Cli::OcciOpts::MEDIA_TYPES.each do |mt| %>
|
61
|
+
occi --endpoint <%= ENDPOINT -%> [ ... ] --media-type <%= mt -%>
|
62
|
+
<% end %>
|
63
|
+
|
64
|
+
### Output formats
|
65
|
+
<% Occi::Cli::ResourceOutputFactory.allowed_formats.each do |af| %>
|
66
|
+
occi --endpoint <%= ENDPOINT -%> [ ... ] --output-format <%= af -%>
|
67
|
+
<% end %>
|
68
|
+
|
69
|
+
### Attribute values (type-casting)
|
70
|
+
|
71
|
+
occi --endpoint <%= ENDPOINT -%> [ ... ] --attribute attribute_name='attribute_value'
|
72
|
+
occi --endpoint <%= ENDPOINT -%> [ ... ] --attribute attribute_name='num(attribute_value)'
|
73
|
+
occi --endpoint <%= ENDPOINT -%> [ ... ] --attribute attribute_name='float(attribute_value)'
|
74
|
+
occi --endpoint <%= ENDPOINT -%> [ ... ] --attribute attribute_name='bool(attribute_value)'
|
10
75
|
|
11
|
-
occi --endpoint https://localhost:3300/ --action delete --resource /compute/65sd4f654sf65g4-s5fg65sfg465sfg-sf65g46sf5g4sdfg --auth x509
|
data/lib/occi/cli/occi_opts.rb
CHANGED
@@ -168,8 +168,7 @@ module Occi::Cli
|
|
168
168
|
opts.on("-j",
|
169
169
|
"--link URI",
|
170
170
|
Array,
|
171
|
-
"
|
172
|
-
"'create' and resource 'compute'") do |links|
|
171
|
+
"URI of an instance to be linked with the given resource, applicable for actions 'create' and 'link'") do |links|
|
173
172
|
options.links ||= []
|
174
173
|
|
175
174
|
links.each do |link|
|
@@ -180,7 +179,7 @@ module Occi::Cli
|
|
180
179
|
end
|
181
180
|
|
182
181
|
opts.on("-g",
|
183
|
-
"--trigger-action
|
182
|
+
"--trigger-action ACTION",
|
184
183
|
String,
|
185
184
|
"Action to be triggered on the resource, formatted as SCHEME#TERM or SHORT_SCHEME#TERM") do |trigger_action|
|
186
185
|
options.trigger_action = Occi::Cli::OcciOpts::Helper.parse_action(trigger_action)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%- # We always get Occi::Core::Mixins -%>
|
2
2
|
<%- occi_resources.each do |mixin| -%>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
<%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) %>
|
4
|
+
[[ <%= mixin.type_identifier %> ]]
|
5
|
+
title: <%= mixin.title %>
|
6
|
+
term: <%= mixin.term %>
|
7
|
+
location: <%= mixin.location %>
|
8
|
+
<%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) %>
|
9
9
|
<%- end -%>
|
@@ -1,25 +1,26 @@
|
|
1
1
|
<%- # We always get Occi::Core::Resources -%>
|
2
2
|
<%- occi_resources.each do |resource| -%>
|
3
|
-
|
3
|
+
<%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) %>
|
4
|
+
[[ <%= resource.kind.type_identifier %> ]]
|
4
5
|
<%- resource.attributes.names.each_pair do |attribute, value| -%>
|
5
|
-
|
6
|
+
<%= attribute %> = <%= value %>
|
6
7
|
<%- end -%>
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
Links:
|
10
|
+
<%- resource.links.each do |link| %>
|
11
|
+
[[ <%= link.kind.type_identifier %> ]]
|
10
12
|
<%- link.attributes.names.each_pair do |attribute, value| -%>
|
11
|
-
|
13
|
+
<%= attribute %> = <%= value %>
|
12
14
|
<%- end -%>
|
13
|
-
|
14
15
|
<%- end -%>
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
Mixins:
|
18
|
+
<%- resource.mixins.each do |mixin| %>
|
19
|
+
[[ <%= mixin.type_identifier %> ]]
|
20
|
+
title: <%= mixin.title %>
|
21
|
+
term: <%= mixin.term %>
|
22
|
+
location: <%= mixin.location %>
|
22
23
|
<%- end -%>
|
23
|
-
|
24
|
+
<%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) -%>
|
24
25
|
|
25
26
|
<%- end -%>
|
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.7'
|
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.8
|
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-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: occi-api
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.2.0.beta.
|
21
|
+
version: 4.2.0.beta.7
|
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.7
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: json
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|