opennebula-cli 4.4.0 → 4.5.80.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NOTICE +1 -1
- data/bin/oneacct +28 -4
- data/bin/oneacl +3 -3
- data/bin/onecluster +1 -1
- data/bin/onedatastore +1 -1
- data/bin/oneflow +1 -1
- data/bin/oneflow-template +1 -1
- data/bin/onegroup +103 -5
- data/bin/onehost +2 -2
- data/bin/oneimage +1 -1
- data/bin/onetemplate +1 -1
- data/bin/oneuser +2 -2
- data/bin/onevm +1 -1
- data/bin/onevnet +1 -1
- data/bin/onezone +145 -0
- data/lib/cli_helper.rb +73 -17
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper.rb +136 -21
- data/lib/one_helper/oneacct_helper.rb +7 -3
- data/lib/one_helper/oneacl_helper.rb +11 -5
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +1 -1
- data/lib/one_helper/onegroup_helper.rb +114 -25
- data/lib/one_helper/onehost_helper.rb +2 -2
- data/lib/one_helper/oneimage_helper.rb +1 -1
- data/lib/one_helper/onequota_helper.rb +1 -1
- data/lib/one_helper/onetemplate_helper.rb +1 -1
- data/lib/one_helper/oneuser_helper.rb +44 -22
- data/lib/one_helper/onevm_helper.rb +1 -1
- data/lib/one_helper/onevnet_helper.rb +1 -1
- data/lib/one_helper/onezone_helper.rb +104 -0
- metadata +14 -10
@@ -0,0 +1,104 @@
|
|
1
|
+
# -------------------------------------------------------------------------- #
|
2
|
+
# Copyright 2002-2014, OpenNebula Project (OpenNebula.org), C12G Labs #
|
3
|
+
# #
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
|
+
# not use this file except in compliance with the License. You may obtain #
|
6
|
+
# a copy of the License at #
|
7
|
+
# #
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
+
# #
|
10
|
+
# Unless required by applicable law or agreed to in writing, software #
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
13
|
+
# See the License for the specific language governing permissions and #
|
14
|
+
# limitations under the License. #
|
15
|
+
#--------------------------------------------------------------------------- #
|
16
|
+
|
17
|
+
require 'one_helper'
|
18
|
+
|
19
|
+
class OneZoneHelper < OpenNebulaHelper::OneHelper
|
20
|
+
|
21
|
+
def self.rname
|
22
|
+
"ZONE"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.conf_file
|
26
|
+
"onezone.yaml"
|
27
|
+
end
|
28
|
+
|
29
|
+
def format_pool(options)
|
30
|
+
config_file = self.class.table_conf
|
31
|
+
|
32
|
+
table = CLIHelper::ShowTable.new(config_file, self) do
|
33
|
+
column :CURRENT, "Active Zone", :size=>1 do |d|
|
34
|
+
"*" if helper.client.one_endpoint.strip ==
|
35
|
+
d["TEMPLATE"]['ENDPOINT'].strip
|
36
|
+
end
|
37
|
+
|
38
|
+
column :ID, "ONE identifier for the Zone", :size=>5 do |d|
|
39
|
+
d["ID"]
|
40
|
+
end
|
41
|
+
|
42
|
+
column :NAME, "Name of the Zone", :left, :size=>25 do |d|
|
43
|
+
d["NAME"]
|
44
|
+
end
|
45
|
+
|
46
|
+
column :ENDPOINT, "Endpoint of the Zone", :left, :size=>45 do |d|
|
47
|
+
d["TEMPLATE"]['ENDPOINT']
|
48
|
+
end
|
49
|
+
|
50
|
+
default :CURRENT, :ID, :NAME, :ENDPOINT
|
51
|
+
end
|
52
|
+
|
53
|
+
table
|
54
|
+
end
|
55
|
+
|
56
|
+
def set_zone(zone_id)
|
57
|
+
zone = factory(zone_id)
|
58
|
+
rc = zone.info
|
59
|
+
|
60
|
+
if OpenNebula.is_error?(rc)
|
61
|
+
return -1, rc.message
|
62
|
+
end
|
63
|
+
|
64
|
+
if !zone['TEMPLATE/ENDPOINT']
|
65
|
+
return -1, "No Endpoint defined for Zone #{zone_id}"
|
66
|
+
end
|
67
|
+
|
68
|
+
File.open(ENV['HOME']+"/.one/one_endpoint", 'w'){|f|
|
69
|
+
f.puts zone['TEMPLATE/ENDPOINT']
|
70
|
+
}
|
71
|
+
|
72
|
+
puts "Endpoint changed to \"#{zone['TEMPLATE/ENDPOINT']}\" in " <<
|
73
|
+
"#{ENV['HOME']}/.one/one_endpoint"
|
74
|
+
return 0
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def factory(id=nil)
|
80
|
+
if id
|
81
|
+
OpenNebula::Zone.new_with_id(id, @client)
|
82
|
+
else
|
83
|
+
xml=OpenNebula::Zone.build_xml
|
84
|
+
OpenNebula::Zone.new(xml, @client)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def factory_pool(user_flag=-2)
|
89
|
+
OpenNebula::ZonePool.new(@client)
|
90
|
+
end
|
91
|
+
|
92
|
+
def format_resource(zone, options = {})
|
93
|
+
str="%-18s: %-20s"
|
94
|
+
str_h1="%-80s"
|
95
|
+
|
96
|
+
CLIHelper.print_header(str_h1 % "ZONE #{zone['ID']} INFORMATION")
|
97
|
+
puts str % ["ID", zone.id.to_s]
|
98
|
+
puts str % ["NAME", zone.name]
|
99
|
+
puts
|
100
|
+
|
101
|
+
CLIHelper.print_header(str_h1 % "ZONE TEMPLATE", false)
|
102
|
+
puts zone.template_str
|
103
|
+
end
|
104
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.80.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opennebula
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.5.80.beta
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.5.80.beta
|
27
27
|
description: Commands used to talk to OpenNebula
|
28
28
|
email: contact@opennebula.org
|
29
29
|
executables:
|
@@ -40,9 +40,12 @@ executables:
|
|
40
40
|
- oneuser
|
41
41
|
- onevm
|
42
42
|
- onevnet
|
43
|
+
- onezone
|
43
44
|
extensions: []
|
44
45
|
extra_rdoc_files: []
|
45
46
|
files:
|
47
|
+
- LICENSE
|
48
|
+
- NOTICE
|
46
49
|
- bin/oneacct
|
47
50
|
- bin/oneacl
|
48
51
|
- bin/onecluster
|
@@ -56,6 +59,7 @@ files:
|
|
56
59
|
- bin/oneuser
|
57
60
|
- bin/onevm
|
58
61
|
- bin/onevnet
|
62
|
+
- bin/onezone
|
59
63
|
- lib/cli_helper.rb
|
60
64
|
- lib/command_parser.rb
|
61
65
|
- lib/one_helper.rb
|
@@ -71,8 +75,7 @@ files:
|
|
71
75
|
- lib/one_helper/oneuser_helper.rb
|
72
76
|
- lib/one_helper/onevm_helper.rb
|
73
77
|
- lib/one_helper/onevnet_helper.rb
|
74
|
-
-
|
75
|
-
- LICENSE
|
78
|
+
- lib/one_helper/onezone_helper.rb
|
76
79
|
homepage: http://opennebula.org
|
77
80
|
licenses: []
|
78
81
|
metadata: {}
|
@@ -82,18 +85,19 @@ require_paths:
|
|
82
85
|
- lib
|
83
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
87
|
requirements:
|
85
|
-
- -
|
88
|
+
- - ">="
|
86
89
|
- !ruby/object:Gem::Version
|
87
90
|
version: '0'
|
88
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
92
|
requirements:
|
90
|
-
- -
|
93
|
+
- - ">"
|
91
94
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
95
|
+
version: 1.3.1
|
93
96
|
requirements: []
|
94
97
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.0
|
98
|
+
rubygems_version: 2.2.0
|
96
99
|
signing_key:
|
97
100
|
specification_version: 4
|
98
101
|
summary: OpenNebula Command Line Interface
|
99
102
|
test_files: []
|
103
|
+
has_rdoc:
|