abiquo-etk 0.6.3 → 0.6.4
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.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/abicli/commands/set.rb +2 -0
- data/lib/abicli/commands/set23.ext +215 -0
- data/lib/abicli/commands/set24.ext +215 -0
- data/lib/abicli/commands/upload-template.rb +20 -6
- metadata +8 -6
data/Rakefile
CHANGED
|
@@ -9,7 +9,7 @@ begin
|
|
|
9
9
|
gem.description = %Q{Tools to troubleshoot and manage your Abiquo installation}
|
|
10
10
|
gem.email = "srubio@abiquo.com"
|
|
11
11
|
gem.homepage = "http://github.com/abiquo/abiquo-etk"
|
|
12
|
-
gem.authors = ["Sergio Rubio","Abel
|
|
12
|
+
gem.authors = ["Sergio Rubio","Abel Boldu"]
|
|
13
13
|
gem.version = File.read 'VERSION'
|
|
14
14
|
gem.add_dependency(%q<nokogiri>, [">= 1.3"])
|
|
15
15
|
gem.add_dependency(%q<rpm-utils>, [">= 0.1"])
|
data/VERSION
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
0.6.
|
|
1
|
+
0.6.4
|
|
2
2
|
|
data/lib/abicli/commands/set.rb
CHANGED
|
@@ -16,6 +16,8 @@ if ARGV[0] == 'set'
|
|
|
16
16
|
load File.dirname(__FILE__) + "/set20.ext"
|
|
17
17
|
elsif rel_info =~ /Version: 2\.2(.*)/
|
|
18
18
|
load File.dirname(__FILE__) + "/set22.ext"
|
|
19
|
+
elsif rel_info =~ /Version: 2\.3(.*)/
|
|
20
|
+
load File.dirname(__FILE__) + "/set23.ext"
|
|
19
21
|
elsif rel_info =~ /Version: 2\.4(.*)/
|
|
20
22
|
load File.dirname(__FILE__) + "/set24.ext"
|
|
21
23
|
else
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'iniparse'
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
if not File.directory? ABIQUO_BASE_DIR
|
|
6
|
+
$stderr.puts "\n'abicli set' command is used to configure the Abiquo Platform.\nUnfortunately, I can't find the Abiquo Platform installed in this server.\n\nTry other commands.\n\n"
|
|
7
|
+
help
|
|
8
|
+
exit 1
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def set_database_host(val)
|
|
12
|
+
url = "jdbc:mysql://#{val}:3306/kinton?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"
|
|
13
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
14
|
+
if File.exist?(f)
|
|
15
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url, true)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
20
|
+
if File.exist?(f)
|
|
21
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url,true)
|
|
22
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'url', url, true)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
set_property('server', 'abiquo.database.host', val)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def set_database_user(val)
|
|
29
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
30
|
+
if File.exist?(f)
|
|
31
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
35
|
+
if File.exist?(f)
|
|
36
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
|
|
37
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'username', val, true)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
set_property('server', 'abiquo.database.user', val)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def set_database_password(val)
|
|
44
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
45
|
+
if File.exist?(f)
|
|
46
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
50
|
+
if File.exist?(f)
|
|
51
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
52
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'password', val, true)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
set_property('server', 'abiquo.database.password', val)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def set_nfs_repository(val)
|
|
59
|
+
begin
|
|
60
|
+
nfs_url = val
|
|
61
|
+
if nfs_url !~ /^nfs:\/\//
|
|
62
|
+
nfs_url = "nfs://#{val}"
|
|
63
|
+
end
|
|
64
|
+
uri = URI.parse(nfs_url)
|
|
65
|
+
host = uri.host
|
|
66
|
+
path = uri.path
|
|
67
|
+
raise Exception.new if (path.nil? or host.nil?)
|
|
68
|
+
rescue
|
|
69
|
+
$stderr.puts 'ERROR: Invalid NFS/CIFS URI'
|
|
70
|
+
return
|
|
71
|
+
end
|
|
72
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
73
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
74
|
+
config['remote-services']['abiquo.appliancemanager.repositoryLocation'] = val
|
|
75
|
+
config['remote-services']['abiquo.virtualfactory.xenserver.repositoryLocation'] = val
|
|
76
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def set_cifs_repository(val)
|
|
80
|
+
begin
|
|
81
|
+
cifs_url = val
|
|
82
|
+
if cifs_url !~ /^cifs:/
|
|
83
|
+
cifs_url = "cifs:#{val}"
|
|
84
|
+
end
|
|
85
|
+
uri = URI.parse(cifs_url)
|
|
86
|
+
host = uri.host
|
|
87
|
+
path = uri.path
|
|
88
|
+
raise Exception.new if (path.nil? or host.nil?)
|
|
89
|
+
rescue
|
|
90
|
+
$stderr.puts 'ERROR: Invalid NFS/CIFS URI'
|
|
91
|
+
return
|
|
92
|
+
end
|
|
93
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
94
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
95
|
+
cifs_uri = "//#{host}#{path}"
|
|
96
|
+
config['remote-services']['abiquo.virtualfactory.hyperv.repositoryLocation'] = cifs_uri
|
|
97
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def set_aim_redis_host(val)
|
|
101
|
+
if not File.exist? '/etc/abiquo-aim.ini'
|
|
102
|
+
raise Exception.new('Abiquo AIM config file not available')
|
|
103
|
+
end
|
|
104
|
+
config = IniParse.parse(File.read('/etc/abiquo-aim.ini'))
|
|
105
|
+
config.save('/etc/abiquo-aim.ini.bak')
|
|
106
|
+
if config['monitor'].nil?
|
|
107
|
+
raise Exception.new('Invalid Abiquo AIM config file')
|
|
108
|
+
end
|
|
109
|
+
config['monitor']['redisHost'] = val
|
|
110
|
+
config.save('/etc/abiquo-aim.ini')
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def set_ontap_user(val)
|
|
114
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
115
|
+
config['remote-services']['abiquo.storagemanager.netapp.user'] = val
|
|
116
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def set_ontap_password(val)
|
|
120
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
121
|
+
config['remote-services']['abiquo.storagemanager.netapp.password'] = val
|
|
122
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def set_property(section, key, val)
|
|
126
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
127
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
128
|
+
config[section][key] = val
|
|
129
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def get_property(section, key)
|
|
133
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
134
|
+
config[section][key] rescue nil
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
$command_mappings = {
|
|
138
|
+
'rabbitmq-host' => Proc.new do |val|
|
|
139
|
+
if get_property('remote-services', 'abiquo.rabbitmq.host')
|
|
140
|
+
set_property('remote-services', 'abiquo.rabbitmq.host', val)
|
|
141
|
+
end
|
|
142
|
+
if get_property('server', 'abiquo.rabbitmq.host')
|
|
143
|
+
set_property('server', 'abiquo.rabbitmq.host', val)
|
|
144
|
+
end
|
|
145
|
+
end,
|
|
146
|
+
'session-timeout' => ['server', 'sessionTimeout'],
|
|
147
|
+
'mail-server' => ['server', 'mail/server'],
|
|
148
|
+
'mail-server-user' => ['server', 'mail/user'],
|
|
149
|
+
'mail-server-password' => ['server', 'mail/password'],
|
|
150
|
+
'nfs-repository' => Proc.new { |val| set_nfs_repository(val) },
|
|
151
|
+
'cifs-repository' => Proc.new do |val|
|
|
152
|
+
set_cifs_repository val
|
|
153
|
+
end,
|
|
154
|
+
'storagelink-address' => Proc.new do |val|
|
|
155
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.address'
|
|
156
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.address', val)
|
|
157
|
+
end
|
|
158
|
+
end,
|
|
159
|
+
'storagelink-user' => Proc.new do |val|
|
|
160
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.user'
|
|
161
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.user', val)
|
|
162
|
+
end
|
|
163
|
+
end,
|
|
164
|
+
'storagelink-password' => Proc.new do |val|
|
|
165
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.password'
|
|
166
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.password', val)
|
|
167
|
+
end
|
|
168
|
+
end,
|
|
169
|
+
'database-host' => Proc.new { |val| set_database_host(val) },
|
|
170
|
+
'database-user' => Proc.new { |val| set_database_user(val) },
|
|
171
|
+
'database-password' => Proc.new { |val| set_database_password(val) },
|
|
172
|
+
'ontap-user' => Proc.new { |val| set_ontap_user(val) },
|
|
173
|
+
'ontap-password' => Proc.new { |val| set_ontap_password(val) },
|
|
174
|
+
'aim-redis-host' => Proc.new { |val| set_aim_redis_host(val) }
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
def mapping_exist?(key)
|
|
178
|
+
$command_mappings.has_key? key
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def mapping_has_proc?(comp)
|
|
182
|
+
$command_mappings[comp].is_a? Proc
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def help
|
|
186
|
+
puts "\nSet Abiquo Platform properties\n\n"
|
|
187
|
+
puts "Available subcommands:"
|
|
188
|
+
$command_mappings.keys.sort.each do |cmd,proc|
|
|
189
|
+
puts " #{cmd}"
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
comp = ARGV[1]
|
|
195
|
+
path = ARGV[2]
|
|
196
|
+
val = ARGV[3]
|
|
197
|
+
file = nil
|
|
198
|
+
begin
|
|
199
|
+
if mapping_exist? comp
|
|
200
|
+
val = path
|
|
201
|
+
if mapping_has_proc? comp
|
|
202
|
+
$command_mappings[comp].call(val)
|
|
203
|
+
else
|
|
204
|
+
comp, path = $command_mappings[comp]
|
|
205
|
+
end
|
|
206
|
+
else
|
|
207
|
+
help
|
|
208
|
+
end
|
|
209
|
+
rescue NoMethodError => e
|
|
210
|
+
$stderr.puts e.message
|
|
211
|
+
$stderr.puts e.backtrace
|
|
212
|
+
$stderr.puts "\nproperty not found in component #{comp.bold}\n\n"
|
|
213
|
+
rescue Exception => e
|
|
214
|
+
$stderr.puts e.message
|
|
215
|
+
end
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'iniparse'
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
if not File.directory? ABIQUO_BASE_DIR
|
|
6
|
+
$stderr.puts "\n'abicli set' command is used to configure the Abiquo Platform.\nUnfortunately, I can't find the Abiquo Platform installed in this server.\n\nTry other commands.\n\n"
|
|
7
|
+
help
|
|
8
|
+
exit 1
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def set_database_host(val)
|
|
12
|
+
url = "jdbc:mysql://#{val}:3306/kinton?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"
|
|
13
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
14
|
+
if File.exist?(f)
|
|
15
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url, true)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
20
|
+
if File.exist?(f)
|
|
21
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url,true)
|
|
22
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'url', url, true)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
set_property('server', 'abiquo.database.host', val)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def set_database_user(val)
|
|
29
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
30
|
+
if File.exist?(f)
|
|
31
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
35
|
+
if File.exist?(f)
|
|
36
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
|
|
37
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'username', val, true)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
set_property('server', 'abiquo.database.user', val)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def set_database_password(val)
|
|
44
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
45
|
+
if File.exist?(f)
|
|
46
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
50
|
+
if File.exist?(f)
|
|
51
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
52
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'password', val, true)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
set_property('server', 'abiquo.database.password', val)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def set_nfs_repository(val)
|
|
59
|
+
begin
|
|
60
|
+
nfs_url = val
|
|
61
|
+
if nfs_url !~ /^nfs:\/\//
|
|
62
|
+
nfs_url = "nfs://#{val}"
|
|
63
|
+
end
|
|
64
|
+
uri = URI.parse(nfs_url)
|
|
65
|
+
host = uri.host
|
|
66
|
+
path = uri.path
|
|
67
|
+
raise Exception.new if (path.nil? or host.nil?)
|
|
68
|
+
rescue
|
|
69
|
+
$stderr.puts 'ERROR: Invalid NFS/CIFS URI'
|
|
70
|
+
return
|
|
71
|
+
end
|
|
72
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
73
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
74
|
+
config['remote-services']['abiquo.appliancemanager.repositoryLocation'] = val
|
|
75
|
+
config['remote-services']['abiquo.virtualfactory.xenserver.repositoryLocation'] = val
|
|
76
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def set_cifs_repository(val)
|
|
80
|
+
begin
|
|
81
|
+
cifs_url = val
|
|
82
|
+
if cifs_url !~ /^cifs:/
|
|
83
|
+
cifs_url = "cifs:#{val}"
|
|
84
|
+
end
|
|
85
|
+
uri = URI.parse(cifs_url)
|
|
86
|
+
host = uri.host
|
|
87
|
+
path = uri.path
|
|
88
|
+
raise Exception.new if (path.nil? or host.nil?)
|
|
89
|
+
rescue
|
|
90
|
+
$stderr.puts 'ERROR: Invalid NFS/CIFS URI'
|
|
91
|
+
return
|
|
92
|
+
end
|
|
93
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
94
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
95
|
+
cifs_uri = "//#{host}#{path}"
|
|
96
|
+
config['remote-services']['abiquo.virtualfactory.hyperv.repositoryLocation'] = cifs_uri
|
|
97
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def set_aim_redis_host(val)
|
|
101
|
+
if not File.exist? '/etc/abiquo-aim.ini'
|
|
102
|
+
raise Exception.new('Abiquo AIM config file not available')
|
|
103
|
+
end
|
|
104
|
+
config = IniParse.parse(File.read('/etc/abiquo-aim.ini'))
|
|
105
|
+
config.save('/etc/abiquo-aim.ini.bak')
|
|
106
|
+
if config['monitor'].nil?
|
|
107
|
+
raise Exception.new('Invalid Abiquo AIM config file')
|
|
108
|
+
end
|
|
109
|
+
config['monitor']['redisHost'] = val
|
|
110
|
+
config.save('/etc/abiquo-aim.ini')
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def set_ontap_user(val)
|
|
114
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
115
|
+
config['remote-services']['abiquo.storagemanager.netapp.user'] = val
|
|
116
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def set_ontap_password(val)
|
|
120
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
121
|
+
config['remote-services']['abiquo.storagemanager.netapp.password'] = val
|
|
122
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def set_property(section, key, val)
|
|
126
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
127
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
128
|
+
config[section][key] = val
|
|
129
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def get_property(section, key)
|
|
133
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
134
|
+
config[section][key] rescue nil
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
$command_mappings = {
|
|
138
|
+
'rabbitmq-host' => Proc.new do |val|
|
|
139
|
+
if get_property('remote-services', 'abiquo.rabbitmq.host')
|
|
140
|
+
set_property('remote-services', 'abiquo.rabbitmq.host', val)
|
|
141
|
+
end
|
|
142
|
+
if get_property('server', 'abiquo.rabbitmq.host')
|
|
143
|
+
set_property('server', 'abiquo.rabbitmq.host', val)
|
|
144
|
+
end
|
|
145
|
+
end,
|
|
146
|
+
'session-timeout' => ['server', 'sessionTimeout'],
|
|
147
|
+
'mail-server' => ['server', 'mail/server'],
|
|
148
|
+
'mail-server-user' => ['server', 'mail/user'],
|
|
149
|
+
'mail-server-password' => ['server', 'mail/password'],
|
|
150
|
+
'nfs-repository' => Proc.new { |val| set_nfs_repository(val) },
|
|
151
|
+
'cifs-repository' => Proc.new do |val|
|
|
152
|
+
set_cifs_repository val
|
|
153
|
+
end,
|
|
154
|
+
'storagelink-address' => Proc.new do |val|
|
|
155
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.address'
|
|
156
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.address', val)
|
|
157
|
+
end
|
|
158
|
+
end,
|
|
159
|
+
'storagelink-user' => Proc.new do |val|
|
|
160
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.user'
|
|
161
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.user', val)
|
|
162
|
+
end
|
|
163
|
+
end,
|
|
164
|
+
'storagelink-password' => Proc.new do |val|
|
|
165
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.password'
|
|
166
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.password', val)
|
|
167
|
+
end
|
|
168
|
+
end,
|
|
169
|
+
'database-host' => Proc.new { |val| set_database_host(val) },
|
|
170
|
+
'database-user' => Proc.new { |val| set_database_user(val) },
|
|
171
|
+
'database-password' => Proc.new { |val| set_database_password(val) },
|
|
172
|
+
'ontap-user' => Proc.new { |val| set_ontap_user(val) },
|
|
173
|
+
'ontap-password' => Proc.new { |val| set_ontap_password(val) },
|
|
174
|
+
'aim-redis-host' => Proc.new { |val| set_aim_redis_host(val) }
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
def mapping_exist?(key)
|
|
178
|
+
$command_mappings.has_key? key
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def mapping_has_proc?(comp)
|
|
182
|
+
$command_mappings[comp].is_a? Proc
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def help
|
|
186
|
+
puts "\nSet Abiquo Platform properties\n\n"
|
|
187
|
+
puts "Available subcommands:"
|
|
188
|
+
$command_mappings.keys.sort.each do |cmd,proc|
|
|
189
|
+
puts " #{cmd}"
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
comp = ARGV[1]
|
|
195
|
+
path = ARGV[2]
|
|
196
|
+
val = ARGV[3]
|
|
197
|
+
file = nil
|
|
198
|
+
begin
|
|
199
|
+
if mapping_exist? comp
|
|
200
|
+
val = path
|
|
201
|
+
if mapping_has_proc? comp
|
|
202
|
+
$command_mappings[comp].call(val)
|
|
203
|
+
else
|
|
204
|
+
comp, path = $command_mappings[comp]
|
|
205
|
+
end
|
|
206
|
+
else
|
|
207
|
+
help
|
|
208
|
+
end
|
|
209
|
+
rescue NoMethodError => e
|
|
210
|
+
$stderr.puts e.message
|
|
211
|
+
$stderr.puts e.backtrace
|
|
212
|
+
$stderr.puts "\nproperty not found in component #{comp.bold}\n\n"
|
|
213
|
+
rescue Exception => e
|
|
214
|
+
$stderr.puts e.message
|
|
215
|
+
end
|
|
@@ -263,13 +263,27 @@ if ARGV[0] == 'upload-template'
|
|
|
263
263
|
fo = File.new(file)
|
|
264
264
|
fsize = File.size(file)
|
|
265
265
|
count = 0
|
|
266
|
-
json
|
|
266
|
+
# Old json format
|
|
267
|
+
# json = """{'ovfPackageInstanceDto':{
|
|
268
|
+
# 'idEnterprise':#{cli.config[:enterprise_id]},
|
|
269
|
+
# 'ovfUrl':'http://upload/#{cli.config[:name]}/#{cli.config[:name]}.ovf',
|
|
270
|
+
# 'diskFileFormat':'#{cli.config[:disk_format]}',
|
|
271
|
+
# 'ramSizeUnit':'BYTE',
|
|
272
|
+
# 'hdSizeUnit':'BYTE',
|
|
273
|
+
# 'diskFilePath':'#{disk_name}',
|
|
274
|
+
# 'name':'#{cli.config[:name]}',
|
|
275
|
+
# 'description':'#{cli.config[:description]}',
|
|
276
|
+
# 'categoryName':'#{cli.config[:category]}',
|
|
277
|
+
# 'iconPath':'#{cli.config[:icon_url]}',
|
|
278
|
+
# 'cpu':#{cli.config[:cpus]},
|
|
279
|
+
# 'hd':#{cli.config[:disk_capacity]},
|
|
280
|
+
# 'ram':#{cli.config[:memory]}
|
|
281
|
+
# }}"""
|
|
282
|
+
json = """{
|
|
267
283
|
'idEnterprise':#{cli.config[:enterprise_id]},
|
|
268
284
|
'ovfUrl':'http://upload/#{cli.config[:name]}/#{cli.config[:name]}.ovf',
|
|
269
|
-
'diskFileFormat':'#{cli.config[:disk_format]}',
|
|
270
|
-
'ramSizeUnit':'BYTE',
|
|
271
|
-
'hdSizeUnit':'BYTE',
|
|
272
285
|
'diskFilePath':'#{disk_name}',
|
|
286
|
+
'diskFileFormat':'#{cli.config[:disk_format]}',
|
|
273
287
|
'name':'#{cli.config[:name]}',
|
|
274
288
|
'description':'#{cli.config[:description]}',
|
|
275
289
|
'categoryName':'#{cli.config[:category]}',
|
|
@@ -277,7 +291,7 @@ json = """{'ovfPackageInstanceDto':{
|
|
|
277
291
|
'cpu':#{cli.config[:cpus]},
|
|
278
292
|
'hd':#{cli.config[:disk_capacity]},
|
|
279
293
|
'ram':#{cli.config[:memory]}
|
|
280
|
-
}
|
|
294
|
+
}"""
|
|
281
295
|
json.gsub!("'",'"')
|
|
282
296
|
$stdout.sync = true
|
|
283
297
|
line_reset = "\r\e[0K"
|
|
@@ -288,7 +302,7 @@ json = """{'ovfPackageInstanceDto':{
|
|
|
288
302
|
end
|
|
289
303
|
StreamingUploader.post(
|
|
290
304
|
rsurl,
|
|
291
|
-
{ :
|
|
305
|
+
{ :diskInfo => json, :diskFile => fo }
|
|
292
306
|
) do |size|
|
|
293
307
|
count += size
|
|
294
308
|
per = (100*count)/fsize
|
metadata
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: abiquo-etk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 15
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 6
|
|
9
|
-
-
|
|
10
|
-
version: 0.6.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.6.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Sergio Rubio
|
|
14
|
-
-
|
|
14
|
+
- Abel Boldu
|
|
15
15
|
autorequire:
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date: 2012-10-
|
|
19
|
+
date: 2012-10-26 00:00:00 Z
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
22
22
|
name: nokogiri
|
|
@@ -97,10 +97,10 @@ dependencies:
|
|
|
97
97
|
description: Tools to troubleshoot and manage your Abiquo installation
|
|
98
98
|
email: srubio@abiquo.com
|
|
99
99
|
executables:
|
|
100
|
-
- abiquo-check-install
|
|
101
100
|
- abicli
|
|
102
101
|
- abiquo-check-16-install
|
|
103
102
|
- ciab-setup
|
|
103
|
+
- abiquo-check-install
|
|
104
104
|
extensions: []
|
|
105
105
|
|
|
106
106
|
extra_rdoc_files:
|
|
@@ -134,6 +134,8 @@ files:
|
|
|
134
134
|
- lib/abicli/commands/set18.ext
|
|
135
135
|
- lib/abicli/commands/set20.ext
|
|
136
136
|
- lib/abicli/commands/set22.ext
|
|
137
|
+
- lib/abicli/commands/set23.ext
|
|
138
|
+
- lib/abicli/commands/set24.ext
|
|
137
139
|
- lib/abicli/commands/smoketest.rb
|
|
138
140
|
- lib/abicli/commands/upload-template.rb
|
|
139
141
|
- lib/abicli/commands/version.rb
|