occi-cli 4.2.0.beta.7 → 4.2.0.beta.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmVhNmZkM2RmN2ZhZjRkOTI1MWYyM2I3YzQyZTk3MjNkYzIzNGJkMA==
4
+ ZGEwNjllMjkwNjhmZWM1N2RmNjNkNzRjYWZmM2FmODZlMTg2N2FjMA==
5
5
  data.tar.gz: !binary |-
6
- NTIyZTVmNDhiZjQ3ZTg2MjVmNThmMTU1OTA3YzZiMzE4NWFlYWMxNQ==
6
+ ZDNjOTJjMjNmZjU1NTE3NjhiNmNkMDgzYzZkNWIwZTZjOTFlNWI5OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmNjNjVhNjc2MmQ1MTA5MzRjMTQ1NjRjMGE2OTE3YjIwYzkwZjUxNmU2ODg4
10
- MGY5ZjdkMGVkOThiY2VlMDNlMmNmMTQzNDY0Y2QwMzJmMDI4N2Y0MmJiMjhj
11
- NDFkNTAyZDk2ZjIxMzhmN2JmN2MwNTAxN2M3ODkyZWRmYjMzZjM=
9
+ NjdkNmI5MWM1ZGIwMTI3ZjJjYjM1NWJiN2ZmYTEzYTA4MDZhM2I1MTE2ZGYw
10
+ ZGJiMDU5ODE3MjlkNzAzOWI3Njg1OTk2NWZkYWJlODMwNTg1N2FiYmViODAx
11
+ Zjg2NDRjMDM0MDBjYzhlZTliZjJiYzZkYjY0MzRhNjljNDU2ZTg=
12
12
  data.tar.gz: !binary |-
13
- M2M1MmFjNTZmNzZhMTAwYzhiYTk4ODJjNjE5NzkxNzE2ZmYyNGMwYTQ0Y2Yy
14
- NzM3NGMwMWIzZmY3MzI3ZjUzZDZkNzRiOTgxZDkyNmViZDQ1MDdhYzVlODll
15
- NDI2Mzc5ZjU1ZTVmMzE5NjdlMmYwMmM1ZjRkZjdkNWY4Zjc1YzE=
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
- mxn = model.get_by_id(mxn.type_identifier)
79
- raise Occi::Cli::Errors::MixinLookupError,
80
- "The specified mixin is not declared in the model! #{mxn.type_identifier.inspect}" if mxn.blank?
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 << mxn
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.merge mixins(options.resource)
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
- mxn = model.get_by_id(mxn.type_identifier)
69
- raise Occi::Cli::Errors::MixinLookupError,
70
- "The specified mixin is not declared in the model! #{mxn.type_identifier.inspect}" if mxn.blank?
71
-
72
- link.mixins << mxn
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
- Examples:
1
+ <%- ENDPOINT = 'http://localhost:3000/' -%>
2
+ # Examples
2
3
 
3
- occi --endpoint https://localhost:3300/ --action list --resource os_tpl --auth x509
4
+ ## Quick reference guide
4
5
 
5
- occi --endpoint https://localhost:3300/ --action list --resource resource_tpl --auth x509
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
- occi --endpoint https://localhost:3300/ --action describe --resource os_tpl#debian6 --auth x509
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
- occi --endpoint https://localhost:3300/ --action create --resource compute --mixin os_tpl#debian6 --mixin resource_tpl#small --attribute title="My rOCCI VM" --auth x509
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
@@ -168,8 +168,7 @@ module Occi::Cli
168
168
  opts.on("-j",
169
169
  "--link URI",
170
170
  Array,
171
- "Link this resource to the resource being created, only for action " \
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 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
- [<%= mixin.type_identifier %>]
4
- Title: <%= mixin.title %>
5
- Term: <%= mixin.term %>
6
- Location: <%= mixin.location %>
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
- [<%= resource.kind.type_identifier %>]
3
+ <%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) %>
4
+ [[ <%= resource.kind.type_identifier %> ]]
4
5
  <%- resource.attributes.names.each_pair do |attribute, value| -%>
5
- <%= attribute %> = <%= value %>
6
+ <%= attribute %> = <%= value %>
6
7
  <%- end -%>
7
8
 
8
- <%- resource.links.each do |link| -%>
9
- [<%= link.kind.type_identifier %>]
9
+ Links:
10
+ <%- resource.links.each do |link| %>
11
+ [[ <%= link.kind.type_identifier %> ]]
10
12
  <%- link.attributes.names.each_pair do |attribute, value| -%>
11
- <%= attribute %> = <%= value %>
13
+ <%= attribute %> = <%= value %>
12
14
  <%- end -%>
13
-
14
15
  <%- end -%>
15
16
 
16
- <%- resource.mixins.each do |mixin| -%>
17
- [<%= mixin.type_identifier %>]
18
- Title: <%= mixin.title %>
19
- Term: <%= mixin.term %>
20
- Location: <%= mixin.location %>
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 -%>
@@ -1,5 +1,5 @@
1
1
  module Occi
2
2
  module Cli
3
- VERSION = "4.2.0.beta.7" unless defined?(::Occi::Cli::VERSION)
3
+ VERSION = "4.2.0.beta.8" unless defined?(::Occi::Cli::VERSION)
4
4
  end
5
5
  end
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.6'
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.7
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-08 00:00:00.000000000 Z
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.6
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.6
28
+ version: 4.2.0.beta.7
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: json
31
31
  requirement: !ruby/object:Gem::Requirement