abiquo-etk 0.4.33 → 0.4.42
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 +5 -4
- data/VERSION +1 -1
- data/abiquo-etk.gemspec +2 -2
- data/abiquo-etk.spec +7 -1
- data/bin/abiquo-initenv +76 -50
- data/lib/abicli/commands/instant-deploy.rb +1 -1
- data/lib/abicli/commands/remote-services-settings.rb +11 -19
- data/lib/abicli/commands/remote-services-settings16.ext +19 -0
- data/lib/abicli/commands/remote-services-settings17.ext +25 -0
- data/lib/abicli/commands/server-settings.rb +11 -17
- data/lib/abicli/commands/server-settings168.ext +17 -0
- data/lib/abicli/commands/server-settings17.ext +25 -0
- data/lib/abicli/commands/set.rb +12 -168
- data/lib/abicli/commands/set168.ext +167 -0
- data/lib/abicli/commands/set17.ext +205 -0
- data/lib/abiquo-etk.rb +8 -10
- data/lib/upgrades/17-nuclear-launch +37 -0
- metadata +30 -8
- data/.gitignore +0 -21
data/Rakefile
CHANGED
|
@@ -15,6 +15,7 @@ begin
|
|
|
15
15
|
gem.add_dependency(%q<rpm-utils>, [">= 0.1"])
|
|
16
16
|
gem.add_dependency(%q<term-ansicolor>, [">= 1.0"])
|
|
17
17
|
gem.add_dependency(%q<mixlib-cli>, [">= 1.2"])
|
|
18
|
+
gem.add_dependency(%q<iniparse>, [">= 1.1.4"])
|
|
18
19
|
gem.files.include %w(
|
|
19
20
|
scripts/*
|
|
20
21
|
lib/**/*
|
|
@@ -71,10 +72,10 @@ end
|
|
|
71
72
|
|
|
72
73
|
task :updatepkg => [:build, :tarball] do
|
|
73
74
|
version = File.read('VERSION').strip.chomp
|
|
74
|
-
`rm ~/Work/abiquo/git/abiquo-
|
|
75
|
-
`cp ../abiquo-etk-#{version}.tar.gz ~/Work/abiquo/git/abiquo-
|
|
76
|
-
`cp abiquo-etk.spec ~/Work/abiquo/git/abiquo-
|
|
77
|
-
`cp pkg/abiquo-etk-#{version}.gem ~/Work/abiquo/git/abiquo-
|
|
75
|
+
`rm ~/Work/abiquo/git/abiquo-common-rpms/abiquo-etk/abiquo-etk*.tar.gz`
|
|
76
|
+
`cp ../abiquo-etk-#{version}.tar.gz ~/Work/abiquo/git/abiquo-common-rpms/abiquo-etk/`
|
|
77
|
+
`cp abiquo-etk.spec ~/Work/abiquo/git/abiquo-common-rpms/abiquo-etk/`
|
|
78
|
+
`cp pkg/abiquo-etk-#{version}.gem ~/Work/abiquo/git/abiquo-common-rpms/abiquo-etk/`
|
|
78
79
|
end
|
|
79
80
|
|
|
80
81
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.42
|
data/abiquo-etk.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{abiquo-etk}
|
|
8
|
-
s.version = "0.4.
|
|
8
|
+
s.version = "0.4.35"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Sergio Rubio"]
|
|
12
|
-
s.date = %q{2010-11-
|
|
12
|
+
s.date = %q{2010-11-12}
|
|
13
13
|
s.description = %q{Tools to troubleshoot and manage your Abiquo installation}
|
|
14
14
|
s.email = %q{srubio@abiquo.com}
|
|
15
15
|
s.executables = ["abiquo-check-16-install", "abicli", "abiquo-initenv"]
|
data/abiquo-etk.spec
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Summary: Abiquo Elite Toolkit
|
|
7
7
|
Name: rubygem-%{gemname}
|
|
8
|
-
Version: 0.4.
|
|
8
|
+
Version: 0.4.35
|
|
9
9
|
Release: 1%{?dist}
|
|
10
10
|
Group: Development/Languages
|
|
11
11
|
License: GPLv2+ or Ruby
|
|
@@ -55,6 +55,12 @@ rm -rf %{buildroot}
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
%changelog
|
|
58
|
+
* Tue Nov 09 2010 : Sergio Rubio <srubio@abiquo.com> - 0.4.34-1
|
|
59
|
+
- Updated to upstream 0.4.35-1
|
|
60
|
+
|
|
61
|
+
* Tue Nov 09 2010 : Sergio Rubio <srubio@abiquo.com> - 0.4.34-1
|
|
62
|
+
- Updated to upstream 0.4.34-1
|
|
63
|
+
|
|
58
64
|
* Thu Nov 04 2010 : Sergio Rubio <srubio@abiquo.com> - 0.4.33-1
|
|
59
65
|
- Updated to upstream 0.4.33-1
|
|
60
66
|
|
data/bin/abiquo-initenv
CHANGED
|
@@ -6,11 +6,23 @@ require 'abiquo-etk'
|
|
|
6
6
|
def create_schemas(user = 'root', password = '')
|
|
7
7
|
log = AETK::Log.instance
|
|
8
8
|
cmd = ''
|
|
9
|
+
|
|
10
|
+
# if abiquo-server RPM not installed, return
|
|
11
|
+
`/bin/rpm -q abiquo-server`
|
|
12
|
+
if $? != 0
|
|
13
|
+
log.warn 'abiquo-server package not found. Skipping schema creation.'
|
|
14
|
+
return
|
|
15
|
+
end
|
|
9
16
|
if password.strip.chomp.empty?
|
|
10
17
|
cmd = "mysql -u #{user} "
|
|
11
18
|
else
|
|
12
19
|
cmd = "mysql -u #{user} -p#{password} "
|
|
13
20
|
end
|
|
21
|
+
|
|
22
|
+
if `#{cmd} -e 'show databases'` != 0
|
|
23
|
+
log.error "Can't access MySQL with username #{user}, password #{password}"
|
|
24
|
+
return
|
|
25
|
+
end
|
|
14
26
|
|
|
15
27
|
if `#{cmd} -e 'show databases'|grep kinton`.strip.chomp.empty?
|
|
16
28
|
out = `mysql -u root < /usr/share/doc/abiquo-server/database/kinton-schema.sql`
|
|
@@ -32,55 +44,46 @@ def create_schemas(user = 'root', password = '')
|
|
|
32
44
|
end
|
|
33
45
|
|
|
34
46
|
def init_server_install
|
|
35
|
-
config_file ='/
|
|
47
|
+
config_file ='/opt/abiquo/config/abiquo.properties'
|
|
36
48
|
log = AETK::Log.instance
|
|
37
49
|
|
|
38
50
|
begin
|
|
39
51
|
if File.exist? config_file
|
|
40
|
-
|
|
52
|
+
settings = abiquo_server_settings
|
|
41
53
|
else
|
|
42
54
|
log.error "Config file #{config_file} does not exist. Exit."
|
|
43
55
|
exit
|
|
44
56
|
end
|
|
45
57
|
|
|
46
|
-
log.info "Setting EventSink URL"
|
|
47
|
-
`abicli set event-sink-url http://#{@settings['abiquo_server_ip']}/server/EventSink`
|
|
48
|
-
|
|
49
58
|
log.info "Setting DB Properties"
|
|
50
|
-
`abicli set database-host #{
|
|
59
|
+
`abicli set database-host #{settings['abiquo.database.host']}`
|
|
51
60
|
`abicli set database-user root`
|
|
52
|
-
`abicli set database-password #{
|
|
61
|
+
`abicli set database-password #{settings['abiquo.database.password']}`
|
|
53
62
|
`abicli set mail-server 127.0.0.1`
|
|
54
63
|
|
|
55
64
|
log.info "Creating database schemas..."
|
|
56
65
|
create_schemas
|
|
57
66
|
rescue Exception => e
|
|
58
67
|
log.error "Unhandled exception: #{e.message}"
|
|
59
|
-
log.error "
|
|
68
|
+
log.error "BACKTRACE: #{e.backtrace}"
|
|
69
|
+
raise e
|
|
60
70
|
end
|
|
61
71
|
end
|
|
62
72
|
|
|
63
73
|
def init_remote_services_install
|
|
64
|
-
config_file ='/
|
|
74
|
+
config_file ='/opt/abiquo/config/abiquo.properties'
|
|
65
75
|
|
|
66
76
|
log = AETK::Log.instance
|
|
67
77
|
|
|
68
78
|
begin
|
|
69
|
-
|
|
79
|
+
settings = {}
|
|
70
80
|
if File.exist? config_file
|
|
71
|
-
|
|
81
|
+
settings = abiquo_rs_settings
|
|
72
82
|
else
|
|
73
83
|
log.error "Config file #{config_file} does not exist. Exit."
|
|
74
84
|
exit
|
|
75
85
|
end
|
|
76
|
-
repo =
|
|
77
|
-
if repo =~ /localhost|127.0.0.1/
|
|
78
|
-
if File.exist? '/etc/sysconfig/abiquo-server'
|
|
79
|
-
log.info "NFS Repository points to localhost, fixing..."
|
|
80
|
-
s = abiquo_server_settings
|
|
81
|
-
repo = s['abiquo_server_ip'] + ':/opt/vm_repository'
|
|
82
|
-
end
|
|
83
|
-
end
|
|
86
|
+
repo = settings['abiquo.appliancemanager.repositoryLocation']
|
|
84
87
|
log.info "Setting nfs-repository to #{repo}"
|
|
85
88
|
`abicli set nfs-repository #{repo}`
|
|
86
89
|
log.info "Setting cifs-repository to #{repo}"
|
|
@@ -88,13 +91,12 @@ def init_remote_services_install
|
|
|
88
91
|
|
|
89
92
|
rescue Exception => e
|
|
90
93
|
log.error "Unhandled exception: #{e.message}"
|
|
91
|
-
log.error "
|
|
94
|
+
log.error "BACKTRACE: #{e.backtrace}"
|
|
95
|
+
raise e
|
|
92
96
|
end
|
|
93
97
|
end
|
|
94
98
|
|
|
95
99
|
def init_v2v_install
|
|
96
|
-
config_file ='/etc/sysconfig/abiquo-server'
|
|
97
|
-
log = AETK::Log.instance
|
|
98
100
|
end
|
|
99
101
|
|
|
100
102
|
def init_rs_plus_v2v_install
|
|
@@ -104,6 +106,34 @@ end
|
|
|
104
106
|
|
|
105
107
|
log = AETK::Log.instance
|
|
106
108
|
log.info "Running abiquo-initenv..."
|
|
109
|
+
|
|
110
|
+
# Check if we need to run
|
|
111
|
+
if File.exist?(ABIQUO_BASE_DIR + '/config/.configured') and \
|
|
112
|
+
(not File.exists?(ABIQUO_BASE_DIR + '/config/.needsupgrade'))
|
|
113
|
+
log.info "Ok Sargent. No need to change anything. Exit."
|
|
114
|
+
exit 0
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
begin
|
|
118
|
+
if File.exist?('/opt/abiquo/config/.needsupgrade')
|
|
119
|
+
log.info "Upgrade needed, upgrading..."
|
|
120
|
+
upgrade_script = File.readlines('/opt/abiquo/config/.needsupgrade').first
|
|
121
|
+
if not upgrade_script.nil?
|
|
122
|
+
script_file = File.dirname(__FILE__) + "/../lib/upgrades/#{upgrade_script.strip.chomp}"
|
|
123
|
+
log.info "Using upgrade script #{script_file}"
|
|
124
|
+
load script_file
|
|
125
|
+
log.info "Upgrade completed succesfully."
|
|
126
|
+
else
|
|
127
|
+
log.error "Invalid upgrade script found in .needsupgrade file. Aborting the upgrade"
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
rescue Exception => e
|
|
131
|
+
log.error "Unknown error upgrading: #{e.message}"
|
|
132
|
+
log.error "BACKTRACE: #{e.backtrace}"
|
|
133
|
+
log.error "Aborting."
|
|
134
|
+
exit 1
|
|
135
|
+
end
|
|
136
|
+
|
|
107
137
|
case AETK::System.detect_install_type
|
|
108
138
|
when :monolithic
|
|
109
139
|
log.info "Monolithic install detected. Setting up the environment."
|
|
@@ -127,36 +157,32 @@ else
|
|
|
127
157
|
end
|
|
128
158
|
|
|
129
159
|
#
|
|
130
|
-
#
|
|
160
|
+
# Set nofile limits in /etc/security/limits.conf
|
|
131
161
|
#
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
buf.each_line do |l|
|
|
144
|
-
if l =~ /ontap_password/
|
|
145
|
-
password = l.split('=').last.strip.chomp rescue ''
|
|
146
|
-
AETK::Log.info "ONTAP: Configure ontap-password"
|
|
147
|
-
`abicli set ontap-password #{password}`
|
|
148
|
-
end
|
|
162
|
+
begin
|
|
163
|
+
slimits_found = false
|
|
164
|
+
hlimits_found = false
|
|
165
|
+
File.readlines('/etc/security/limits.conf').each do |l|
|
|
166
|
+
slimits_found = true if l =~ /^\s*root\s+soft\s+nofile\s+4096/
|
|
167
|
+
hlimits_found = true if l =~ /^\s*root\s+hard\s+nofile\s+10240/
|
|
168
|
+
end
|
|
169
|
+
if not slimits_found
|
|
170
|
+
AETK::Log.info "Setting soft nofile limits to 4096"
|
|
171
|
+
File.open('/etc/security/limits.conf', 'a') do |f|
|
|
172
|
+
f.puts "root soft nofile 4096"
|
|
149
173
|
end
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
end
|
|
174
|
+
end
|
|
175
|
+
if not hlimits_found
|
|
176
|
+
AETK::Log.info "Setting hard nofile limits to 10240"
|
|
177
|
+
File.open('/etc/security/limits.conf', 'a') do |f|
|
|
178
|
+
f.puts "root hard nofile 10240"
|
|
156
179
|
end
|
|
157
|
-
else
|
|
158
|
-
AETK::Log.warn "/etc/sysconfig/abiquo-rs config file not found. Skipping ONTAP configuration."
|
|
159
180
|
end
|
|
160
|
-
|
|
161
|
-
|
|
181
|
+
if slimits_found and hlimits_found
|
|
182
|
+
AETK::Log.info "System hard/soft nofile limits Ok. Not updating."
|
|
183
|
+
end
|
|
184
|
+
rescue Exception => e
|
|
185
|
+
AETK::Log.error "Error setting nofile limits: #{e.message}"
|
|
162
186
|
end
|
|
187
|
+
|
|
188
|
+
FileUtils.touch(ABIQUO_BASE_DIR + '/config/.configured')
|
|
@@ -154,7 +154,7 @@ if ARGV[0] == 'instant-deploy'
|
|
|
154
154
|
end
|
|
155
155
|
|
|
156
156
|
def pfcheck_redhat
|
|
157
|
-
if File.read('/etc/redhat-release') !~ /^(FrameOS|CentOS)/
|
|
157
|
+
if File.read('/etc/redhat-release') !~ /^(FrameOS|CentOS|Red Hat Enterprise|Fedora)/
|
|
158
158
|
$stderr.puts "\nRHEL not found. Your distribution is not supported.\n\n"
|
|
159
159
|
exit
|
|
160
160
|
end
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
if ARGV[0] == 'remote-services-settings'
|
|
2
|
-
|
|
3
2
|
ARGV.shift
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
help
|
|
8
|
-
exit 1
|
|
3
|
+
if not File.exist?('/etc/abiquo-release')
|
|
4
|
+
$stderr.puts "Abiquo release version not found. Unsupported installation."
|
|
5
|
+
exit
|
|
9
6
|
end
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
two_cols("Storage Link User:".bold, config_get_node(doc, 'storagelink/user'))
|
|
19
|
-
two_cols("Storage Link Password:".bold, config_get_node(doc, 'storagelink/password'))
|
|
20
|
-
puts
|
|
7
|
+
rel_info = File.read('/etc/abiquo-release')
|
|
8
|
+
if rel_info =~ /Version: 1\.7/
|
|
9
|
+
load File.dirname(__FILE__) + "/remote-services-settings17.ext"
|
|
10
|
+
elsif rel_info =~ /Version: 1\.6/
|
|
11
|
+
load File.dirname(__FILE__) + "/remote-services-settings16.ext"
|
|
12
|
+
else
|
|
13
|
+
$stderr.puts "Abiquo release version not found. Unsupported installation."
|
|
14
|
+
exit
|
|
21
15
|
end
|
|
22
|
-
|
|
23
|
-
print_remote_services_settings
|
|
24
16
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
if not File.directory? ABIQUO_BASE_DIR
|
|
2
|
+
$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"
|
|
3
|
+
help
|
|
4
|
+
exit 1
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def print_remote_services_settings
|
|
8
|
+
f = ABIQUO_BASE_DIR + '/config/virtualfactory.xml'
|
|
9
|
+
doc = Nokogiri::XML(File.new(f))
|
|
10
|
+
puts
|
|
11
|
+
two_cols("NFS Repository:".bold, config_get_node(doc, 'hypervisors/xenserver/abiquoRepository'))
|
|
12
|
+
two_cols("CIFS Repository:".bold, config_get_node(doc, 'hypervisors/hyperv/destinationRepositoryPath'))
|
|
13
|
+
two_cols("Storage Link URL:".bold, config_get_node(doc, 'storagelink/address'))
|
|
14
|
+
two_cols("Storage Link User:".bold, config_get_node(doc, 'storagelink/user'))
|
|
15
|
+
two_cols("Storage Link Password:".bold, config_get_node(doc, 'storagelink/password'))
|
|
16
|
+
puts
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
print_remote_services_settings
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'iniparse'
|
|
3
|
+
|
|
4
|
+
settings_file = "#{ABIQUO_BASE_DIR}/config/abiquo.properties"
|
|
5
|
+
|
|
6
|
+
if File.exist? settings_file
|
|
7
|
+
|
|
8
|
+
begin
|
|
9
|
+
ini = IniParse.parse File.read(settings_file)
|
|
10
|
+
raise Exception.new('Missing [remote-services] section') if ini['remote-services'].nil?
|
|
11
|
+
|
|
12
|
+
puts "\nAbiquo Remote Services Configuration"
|
|
13
|
+
puts "-------------------------------------\n\n"
|
|
14
|
+
|
|
15
|
+
File.read(settings_file).each_line do |l|
|
|
16
|
+
next if l =~ /\[.*?\]/
|
|
17
|
+
puts l
|
|
18
|
+
end
|
|
19
|
+
rescue Exception => e
|
|
20
|
+
puts "Invalid properties file. Missing [remote-services] section?"
|
|
21
|
+
puts "DEBUG: #{e.message}"
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
$stderr.puts "abiquo.properties file not found. Cannot retrieve properties."
|
|
25
|
+
end
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
if ARGV[0] == 'server-settings'
|
|
2
|
-
|
|
3
2
|
ARGV.shift
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
help
|
|
8
|
-
exit 1
|
|
3
|
+
if not File.exist?('/etc/abiquo-release')
|
|
4
|
+
$stderr.puts "Abiquo release version not found. Unsupported installation."
|
|
5
|
+
exit
|
|
9
6
|
end
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
rel_info = File.read('/etc/abiquo-release')
|
|
8
|
+
if rel_info =~ /Version: 1\.7/
|
|
9
|
+
load File.dirname(__FILE__) + "/server-settings17.ext"
|
|
10
|
+
elsif rel_info =~ /Version: 1\.6/
|
|
11
|
+
load File.dirname(__FILE__) + "/server-settings168.ext"
|
|
12
|
+
else
|
|
13
|
+
$stderr.puts "Abiquo release version not found. Unsupported installation."
|
|
14
|
+
exit
|
|
18
15
|
end
|
|
19
|
-
|
|
20
|
-
print_server_settings
|
|
21
|
-
|
|
22
16
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
if not File.directory? ABIQUO_BASE_DIR
|
|
2
|
+
$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"
|
|
3
|
+
help
|
|
4
|
+
exit 1
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def print_server_settings
|
|
8
|
+
f = ABIQUO_BASE_DIR + '/config/server.xml'
|
|
9
|
+
doc = Nokogiri::XML(File.new(f))
|
|
10
|
+
puts
|
|
11
|
+
two_cols("Event Sink URL:".bold, config_get_node(doc, 'eventSinkAddress'))
|
|
12
|
+
two_cols("Session Timeout:".bold, config_get_node(doc, 'sessionTimeout'))
|
|
13
|
+
puts
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
print_server_settings
|
|
17
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'iniparse'
|
|
3
|
+
|
|
4
|
+
settings_file = "#{ABIQUO_BASE_DIR}/config/abiquo.properties"
|
|
5
|
+
|
|
6
|
+
if File.exist? settings_file
|
|
7
|
+
|
|
8
|
+
begin
|
|
9
|
+
ini = IniParse.parse File.read(settings_file)
|
|
10
|
+
raise Exception.new('Missing [server] section') if ini['server'].nil?
|
|
11
|
+
|
|
12
|
+
puts "\nAbiquo Server Configuration"
|
|
13
|
+
puts "----------------------------\n\n"
|
|
14
|
+
|
|
15
|
+
File.read(settings_file).each_line do |l|
|
|
16
|
+
next if l =~ /\[.*?\]/
|
|
17
|
+
puts l
|
|
18
|
+
end
|
|
19
|
+
rescue Exception => e
|
|
20
|
+
puts "Invalid properties file. Missing [server] section?"
|
|
21
|
+
puts "DEBUG: #{e.message}"
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
$stderr.puts "abiquo.properties file not found. Cannot retrieve properties."
|
|
25
|
+
end
|
data/lib/abicli/commands/set.rb
CHANGED
|
@@ -1,171 +1,15 @@
|
|
|
1
1
|
if ARGV[0] == 'set'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
if not File.exist?('/etc/abiquo-release')
|
|
3
|
+
$stderr.puts "Abiquo release version not found. Unsupported installation."
|
|
4
|
+
exit
|
|
5
|
+
end
|
|
6
|
+
rel_info = File.read('/etc/abiquo-release')
|
|
7
|
+
if rel_info =~ /Version: 1\.7/
|
|
8
|
+
load File.dirname(__FILE__) + "/set17.ext"
|
|
9
|
+
elsif rel_info =~ /Version: 1\.6/
|
|
10
|
+
load File.dirname(__FILE__) + "/set168.ext"
|
|
11
|
+
else
|
|
12
|
+
$stderr.puts "Abiquo release version not found. Unsupported installation."
|
|
13
|
+
exit
|
|
7
14
|
end
|
|
8
|
-
|
|
9
|
-
def set_database_host(val)
|
|
10
|
-
url = "jdbc:mysql://#{val}:3306/kinton?autoReconnect=true"
|
|
11
|
-
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
12
|
-
if File.exist?(f)
|
|
13
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url, true)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
18
|
-
if File.exist?(f)
|
|
19
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url,true)
|
|
20
|
-
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'url', url, true)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
[TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
|
|
24
|
-
if File.exist?(f)
|
|
25
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'url', url, true)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def set_database_user(val)
|
|
31
|
-
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
32
|
-
if File.exist?(f)
|
|
33
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
37
|
-
if File.exist?(f)
|
|
38
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
|
|
39
|
-
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'username', val, true)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
[TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
|
|
43
|
-
if File.exist?(f)
|
|
44
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'username', val, true)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def set_database_password(val)
|
|
50
|
-
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
51
|
-
if File.exist?(f)
|
|
52
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
56
|
-
if File.exist?(f)
|
|
57
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
58
|
-
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'password', val, true)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
[TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
|
|
62
|
-
if File.exist?(f)
|
|
63
|
-
config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'password', val, true)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def set_nfs_repository(val)
|
|
69
|
-
f = ABIQUO_BASE_DIR + '/config/am.xml'
|
|
70
|
-
if File.exist? f
|
|
71
|
-
config_set_node(f, 'repository/location', val, true)
|
|
72
|
-
end
|
|
73
|
-
f = ABIQUO_BASE_DIR + '/config/virtualfactory.xml'
|
|
74
|
-
if File.exist? f
|
|
75
|
-
config_set_node(f, 'hypervisors/xenserver/abiquoRepository', val, true)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def set_ontap_server_ip(val)
|
|
80
|
-
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
81
|
-
if File.exist? f
|
|
82
|
-
config_set_node(f, 'filer/host', val, true)
|
|
83
|
-
else
|
|
84
|
-
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def set_ontap_user(val)
|
|
89
|
-
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
90
|
-
if File.exist? f
|
|
91
|
-
config_set_node(f, 'filer/user', val, true)
|
|
92
|
-
else
|
|
93
|
-
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def set_ontap_password(val)
|
|
98
|
-
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
99
|
-
if File.exist? f
|
|
100
|
-
config_set_node(f, 'filer/password', val, true)
|
|
101
|
-
else
|
|
102
|
-
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
$command_mappings = {
|
|
107
|
-
'event-sink-url' => ['server', 'eventSinkAddress'],
|
|
108
|
-
'session-timeout' => ['server', 'sessionTimeout'],
|
|
109
|
-
'mail-server' => ['server', 'mail/server'],
|
|
110
|
-
'mail-server-user' => ['server', 'mail/user'],
|
|
111
|
-
'mail-server-password' => ['server', 'mail/password'],
|
|
112
|
-
'nfs-repository' => Proc.new { |val| set_nfs_repository(val) },
|
|
113
|
-
'cifs-repository' => ['virtualfactory', 'hypervisors/hyperv/destinationRepositoryPath'],
|
|
114
|
-
'storagelink-address' => ['virtualfactory', 'storagelink/address'],
|
|
115
|
-
'storagelink-user' => ['virtualfactory', 'storagelink/user'],
|
|
116
|
-
'storagelink-password' => ['virtualfactory', 'storagelink/password'],
|
|
117
|
-
'database-host' => Proc.new { |val| set_database_host(val) },
|
|
118
|
-
'database-user' => Proc.new { |val| set_database_user(val) },
|
|
119
|
-
'database-password' => Proc.new { |val| set_database_password(val) },
|
|
120
|
-
'ontap-user' => Proc.new { |val| set_ontap_user(val) },
|
|
121
|
-
'ontap-password' => Proc.new { |val| set_ontap_password(val) },
|
|
122
|
-
'ontap-server-ip' => Proc.new { |val| set_ontap_server_ip(val) }
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
def mapping_exist?(key)
|
|
126
|
-
$command_mappings.has_key? key
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def mapping_has_proc?(comp)
|
|
130
|
-
$command_mappings[comp].is_a? Proc
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def help
|
|
134
|
-
puts "\nSet Abiquo Platform properties\n\n"
|
|
135
|
-
puts "Available subcommands:"
|
|
136
|
-
$command_mappings.keys.sort.each do |cmd,proc|
|
|
137
|
-
puts " #{cmd}"
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
comp = ARGV[1]
|
|
143
|
-
path = ARGV[2]
|
|
144
|
-
val = ARGV[3]
|
|
145
|
-
file = nil
|
|
146
|
-
begin
|
|
147
|
-
if mapping_exist? comp
|
|
148
|
-
val = path
|
|
149
|
-
if mapping_has_proc? comp
|
|
150
|
-
$command_mappings[comp].call(val)
|
|
151
|
-
exit
|
|
152
|
-
end
|
|
153
|
-
comp, path = $command_mappings[comp]
|
|
154
|
-
else
|
|
155
|
-
help
|
|
156
|
-
exit 0
|
|
157
|
-
end
|
|
158
|
-
file = File.join(ABIQUO_BASE_DIR, "config/#{comp}.xml")
|
|
159
|
-
if not File.exist?(file)
|
|
160
|
-
AETK::Log.instance.error "File #{file} does not exist. Skip setting the property: #{path}"
|
|
161
|
-
else
|
|
162
|
-
config_set_node(file, path, val, true)
|
|
163
|
-
end
|
|
164
|
-
rescue NoMethodError => e
|
|
165
|
-
$stderr.puts e.message
|
|
166
|
-
$stderr.puts e.backtrace
|
|
167
|
-
$stderr.puts "\nproperty not found in component #{comp.bold}\n\n"
|
|
168
|
-
exit 1
|
|
169
|
-
end
|
|
170
|
-
|
|
171
15
|
end
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
if not File.directory? ABIQUO_BASE_DIR
|
|
2
|
+
$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"
|
|
3
|
+
help
|
|
4
|
+
exit 1
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def set_database_host(val)
|
|
8
|
+
url = "jdbc:mysql://#{val}:3306/kinton?autoReconnect=true"
|
|
9
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
10
|
+
if File.exist?(f)
|
|
11
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url, true)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
16
|
+
if File.exist?(f)
|
|
17
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url,true)
|
|
18
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'url', url, true)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
[TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
|
|
22
|
+
if File.exist?(f)
|
|
23
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'url', url, true)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
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
|
+
[TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
|
|
41
|
+
if File.exist?(f)
|
|
42
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'username', val, true)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def set_database_password(val)
|
|
48
|
+
[TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
|
|
49
|
+
if File.exist?(f)
|
|
50
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
[TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
|
|
54
|
+
if File.exist?(f)
|
|
55
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
|
|
56
|
+
config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'password', val, true)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
[TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
|
|
60
|
+
if File.exist?(f)
|
|
61
|
+
config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'password', val, true)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def set_nfs_repository(val)
|
|
67
|
+
f = ABIQUO_BASE_DIR + '/config/am.xml'
|
|
68
|
+
if File.exist? f
|
|
69
|
+
config_set_node(f, 'repository/location', val, true)
|
|
70
|
+
end
|
|
71
|
+
f = ABIQUO_BASE_DIR + '/config/virtualfactory.xml'
|
|
72
|
+
if File.exist? f
|
|
73
|
+
config_set_node(f, 'hypervisors/xenserver/abiquoRepository', val, true)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def set_ontap_server_ip(val)
|
|
78
|
+
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
79
|
+
if File.exist? f
|
|
80
|
+
config_set_node(f, 'filer/host', val, true)
|
|
81
|
+
else
|
|
82
|
+
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def set_ontap_user(val)
|
|
87
|
+
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
88
|
+
if File.exist? f
|
|
89
|
+
config_set_node(f, 'filer/user', val, true)
|
|
90
|
+
else
|
|
91
|
+
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def set_ontap_password(val)
|
|
96
|
+
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
97
|
+
if File.exist? f
|
|
98
|
+
config_set_node(f, 'filer/password', val, true)
|
|
99
|
+
else
|
|
100
|
+
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
$command_mappings = {
|
|
105
|
+
'event-sink-url' => ['server', 'eventSinkAddress'],
|
|
106
|
+
'session-timeout' => ['server', 'sessionTimeout'],
|
|
107
|
+
'mail-server' => ['server', 'mail/server'],
|
|
108
|
+
'mail-server-user' => ['server', 'mail/user'],
|
|
109
|
+
'mail-server-password' => ['server', 'mail/password'],
|
|
110
|
+
'nfs-repository' => Proc.new { |val| set_nfs_repository(val) },
|
|
111
|
+
'cifs-repository' => ['virtualfactory', 'hypervisors/hyperv/destinationRepositoryPath'],
|
|
112
|
+
'storagelink-address' => ['virtualfactory', 'storagelink/address'],
|
|
113
|
+
'storagelink-user' => ['virtualfactory', 'storagelink/user'],
|
|
114
|
+
'storagelink-password' => ['virtualfactory', 'storagelink/password'],
|
|
115
|
+
'database-host' => Proc.new { |val| set_database_host(val) },
|
|
116
|
+
'database-user' => Proc.new { |val| set_database_user(val) },
|
|
117
|
+
'database-password' => Proc.new { |val| set_database_password(val) },
|
|
118
|
+
'ontap-user' => Proc.new { |val| set_ontap_user(val) },
|
|
119
|
+
'ontap-password' => Proc.new { |val| set_ontap_password(val) },
|
|
120
|
+
'ontap-server-ip' => Proc.new { |val| set_ontap_server_ip(val) }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
def mapping_exist?(key)
|
|
124
|
+
$command_mappings.has_key? key
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def mapping_has_proc?(comp)
|
|
128
|
+
$command_mappings[comp].is_a? Proc
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def help
|
|
132
|
+
puts "\nSet Abiquo Platform properties\n\n"
|
|
133
|
+
puts "Available subcommands:"
|
|
134
|
+
$command_mappings.keys.sort.each do |cmd,proc|
|
|
135
|
+
puts " #{cmd}"
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
comp = ARGV[1]
|
|
141
|
+
path = ARGV[2]
|
|
142
|
+
val = ARGV[3]
|
|
143
|
+
file = nil
|
|
144
|
+
begin
|
|
145
|
+
if mapping_exist? comp
|
|
146
|
+
val = path
|
|
147
|
+
if mapping_has_proc? comp
|
|
148
|
+
$command_mappings[comp].call(val)
|
|
149
|
+
exit
|
|
150
|
+
end
|
|
151
|
+
comp, path = $command_mappings[comp]
|
|
152
|
+
else
|
|
153
|
+
help
|
|
154
|
+
exit 0
|
|
155
|
+
end
|
|
156
|
+
file = File.join(ABIQUO_BASE_DIR, "config/#{comp}.xml")
|
|
157
|
+
if not File.exist?(file)
|
|
158
|
+
AETK::Log.instance.error "File #{file} does not exist. Skip setting the property: #{path}"
|
|
159
|
+
else
|
|
160
|
+
config_set_node(file, path, val, true)
|
|
161
|
+
end
|
|
162
|
+
rescue NoMethodError => e
|
|
163
|
+
$stderr.puts e.message
|
|
164
|
+
$stderr.puts e.backtrace
|
|
165
|
+
$stderr.puts "\nproperty not found in component #{comp.bold}\n\n"
|
|
166
|
+
exit 1
|
|
167
|
+
end
|
|
@@ -0,0 +1,205 @@
|
|
|
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
|
+
uri = URI.parse(val)
|
|
61
|
+
host = uri.host
|
|
62
|
+
path = uri.path
|
|
63
|
+
raise Exception.new if (path.nil? or host.nil?)
|
|
64
|
+
rescue
|
|
65
|
+
$stderr.puts 'ERROR: Invalid NFS/CIFS URI'
|
|
66
|
+
return
|
|
67
|
+
end
|
|
68
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
69
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
70
|
+
config['remote-services']['abiquo.appliancemanager.repositoryLocation'] = val
|
|
71
|
+
config['remote-services']['abiquo.virtualfactory.xenserver.repositoryLocation'] = val
|
|
72
|
+
config['remote-services']['abiquo.virtualfactory.vmware.repositoryLocation'] = val
|
|
73
|
+
cifs_uri = "//#{host}/#{path}"
|
|
74
|
+
config['remote-services']['abiquo.virtualfactory.hyperv.repositoryLocation'] = cifs_uri
|
|
75
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def set_ontap_server_ip(val)
|
|
79
|
+
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
80
|
+
if File.exist? f
|
|
81
|
+
config_set_node(f, 'filer/host', val, true)
|
|
82
|
+
else
|
|
83
|
+
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def set_ontap_user(val)
|
|
88
|
+
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
89
|
+
if File.exist? f
|
|
90
|
+
config_set_node(f, 'filer/user', val, true)
|
|
91
|
+
else
|
|
92
|
+
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def set_ontap_password(val)
|
|
97
|
+
f = ABIQUO_BASE_DIR + '/ontap/tomcat/webapps/ROOT/WEB-INF/classes/config.xml'
|
|
98
|
+
if File.exist? f
|
|
99
|
+
config_set_node(f, 'filer/password', val, true)
|
|
100
|
+
else
|
|
101
|
+
$stderr.puts "NetApp Ontap Connector not installed. Ignoring the order."
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def set_property(section, key, val)
|
|
106
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
107
|
+
config.save('/opt/abiquo/config/abiquo.properties.bak')
|
|
108
|
+
config[section][key] = val
|
|
109
|
+
config.save('/opt/abiquo/config/abiquo.properties')
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def get_property(section, key)
|
|
113
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
|
114
|
+
config[section][key] rescue nil
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
$command_mappings = {
|
|
118
|
+
'rabbitmq-host' => Proc.new do |val|
|
|
119
|
+
if get_property('remote-services', 'abiquo.rabbitmq.host')
|
|
120
|
+
set_property('remote-services', 'abiquo.rabbitmq.host', val)
|
|
121
|
+
end
|
|
122
|
+
if get_property('server', 'abiquo.rabbitmq.host')
|
|
123
|
+
set_property('server', 'abiquo.rabbitmq.host', val)
|
|
124
|
+
end
|
|
125
|
+
end,
|
|
126
|
+
'session-timeout' => ['server', 'sessionTimeout'],
|
|
127
|
+
'mail-server' => ['server', 'mail/server'],
|
|
128
|
+
'mail-server-user' => ['server', 'mail/user'],
|
|
129
|
+
'mail-server-password' => ['server', 'mail/password'],
|
|
130
|
+
'nfs-repository' => Proc.new { |val| set_nfs_repository(val) },
|
|
131
|
+
'cifs-repository' => Proc.new do |val|
|
|
132
|
+
begin
|
|
133
|
+
uri = URI.parse(val)
|
|
134
|
+
host = uri.host
|
|
135
|
+
path = uri.path
|
|
136
|
+
raise Exception.new if (path.nil? or host.nil?)
|
|
137
|
+
cifs_uri = "//#{host}/#{path}"
|
|
138
|
+
set_property 'remote-services', 'abiquo.virtualfactory.hyperv.repositoryLocation', cifs_uri
|
|
139
|
+
rescue Exception => e
|
|
140
|
+
$stderr.puts 'ERROR: Invalid NFS/CIFS URI'
|
|
141
|
+
$stderr.puts "DEBUG: #{e.message}"
|
|
142
|
+
end
|
|
143
|
+
end,
|
|
144
|
+
'storagelink-address' => Proc.new do |val|
|
|
145
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.address'
|
|
146
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.address', val)
|
|
147
|
+
end
|
|
148
|
+
end,
|
|
149
|
+
'storagelink-user' => Proc.new do |val|
|
|
150
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.user'
|
|
151
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.user', val)
|
|
152
|
+
end
|
|
153
|
+
end,
|
|
154
|
+
'storagelink-password' => Proc.new do |val|
|
|
155
|
+
if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.password'
|
|
156
|
+
set_property('remote-services', 'abiquo.virtualfactory.storagelink.password', val)
|
|
157
|
+
end
|
|
158
|
+
end,
|
|
159
|
+
'database-host' => Proc.new { |val| set_database_host(val) },
|
|
160
|
+
'database-user' => Proc.new { |val| set_database_user(val) },
|
|
161
|
+
'database-password' => Proc.new { |val| set_database_password(val) },
|
|
162
|
+
'ontap-user' => Proc.new { |val| set_ontap_user(val) },
|
|
163
|
+
'ontap-password' => Proc.new { |val| set_ontap_password(val) },
|
|
164
|
+
'ontap-server-ip' => Proc.new { |val| set_ontap_server_ip(val) }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
def mapping_exist?(key)
|
|
168
|
+
$command_mappings.has_key? key
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def mapping_has_proc?(comp)
|
|
172
|
+
$command_mappings[comp].is_a? Proc
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def help
|
|
176
|
+
puts "\nSet Abiquo Platform properties\n\n"
|
|
177
|
+
puts "Available subcommands:"
|
|
178
|
+
$command_mappings.keys.sort.each do |cmd,proc|
|
|
179
|
+
puts " #{cmd}"
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
comp = ARGV[1]
|
|
185
|
+
path = ARGV[2]
|
|
186
|
+
val = ARGV[3]
|
|
187
|
+
file = nil
|
|
188
|
+
begin
|
|
189
|
+
if mapping_exist? comp
|
|
190
|
+
val = path
|
|
191
|
+
if mapping_has_proc? comp
|
|
192
|
+
$command_mappings[comp].call(val)
|
|
193
|
+
exit
|
|
194
|
+
end
|
|
195
|
+
comp, path = $command_mappings[comp]
|
|
196
|
+
else
|
|
197
|
+
help
|
|
198
|
+
exit 0
|
|
199
|
+
end
|
|
200
|
+
rescue NoMethodError => e
|
|
201
|
+
$stderr.puts e.message
|
|
202
|
+
$stderr.puts e.backtrace
|
|
203
|
+
$stderr.puts "\nproperty not found in component #{comp.bold}\n\n"
|
|
204
|
+
exit 1
|
|
205
|
+
end
|
data/lib/abiquo-etk.rb
CHANGED
|
@@ -32,7 +32,7 @@ ABIQUO_BPMASYNC_CONFIG = '/opt/abiquo/config/bpm-async.xml'
|
|
|
32
32
|
def abiquo_edition
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
def abiquo_server_settings(file = '/
|
|
35
|
+
def abiquo_server_settings(file = '/opt/abiquo/config/abiquo.properties')
|
|
36
36
|
settings = {}
|
|
37
37
|
File.read(file).each_line do |l|
|
|
38
38
|
next if l.strip.chomp.empty?
|
|
@@ -42,14 +42,8 @@ def abiquo_server_settings(file = '/etc/sysconfig/abiquo-server')
|
|
|
42
42
|
settings
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def abiquo_rs_settings(file = '/
|
|
46
|
-
|
|
47
|
-
File.read(file).each_line do |l|
|
|
48
|
-
next if l.strip.chomp.empty?
|
|
49
|
-
key,val = l.strip.chomp.split('=')
|
|
50
|
-
settings[key.strip.chomp] = val.strip.chomp rescue ''
|
|
51
|
-
end
|
|
52
|
-
settings
|
|
45
|
+
def abiquo_rs_settings(file = '/opt/abiquo/config/abiquo.properties')
|
|
46
|
+
abiquo_server_settings
|
|
53
47
|
end
|
|
54
48
|
|
|
55
49
|
def abiquo_base_dir
|
|
@@ -151,7 +145,11 @@ module AETK
|
|
|
151
145
|
end
|
|
152
146
|
|
|
153
147
|
def self.instance(file = '/var/log/abiquo-etk.log')
|
|
154
|
-
|
|
148
|
+
begin
|
|
149
|
+
@@logger ||= Logger.new file
|
|
150
|
+
rescue Exception
|
|
151
|
+
@@logger ||= Logger.new $stderr
|
|
152
|
+
end
|
|
155
153
|
end
|
|
156
154
|
|
|
157
155
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
require 'logger'
|
|
5
|
+
|
|
6
|
+
log = Logger.new '/var/log/17-nuclear-launch.log'
|
|
7
|
+
|
|
8
|
+
if not File.directory?('/opt/abiquo/backup/1.6.8')
|
|
9
|
+
log.error '/opt/abiquo/backup/1.6.8 directory not found.Aborting upgrade.'
|
|
10
|
+
exit 1
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
`mkdir -p /opt/abiquo/backup/1.6.8/database/`
|
|
14
|
+
log.info "Dumping current database schema..."
|
|
15
|
+
output = `/usr/bin/mysqldump -R -u root kinton > /opt/abiquo/backup/1.6.8/database/kinton-#{Time.now.strftime('%F_%H%M')}.sql 2>&1`
|
|
16
|
+
if $? != 0
|
|
17
|
+
log.error "MySQL backup failed: #{output}"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
log.info "Applying upgrade deltas (kinton-delta-1_6_8-to-1_7_0)..."
|
|
21
|
+
output = `/usr/bin/mysql -u root kinton 2>&1 < /usr/share/doc/abiquo-server/database/kinton-delta-1_6_8-to-1_7_0.sql`
|
|
22
|
+
if $? != 0
|
|
23
|
+
log.error "Upgrading database schema failed: #{output}"
|
|
24
|
+
log.error "Aborting the upgrade."
|
|
25
|
+
exit 1
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
log.info "Applying upgrade deltas (kinton-premium-delta-1_6_8-to-1_7_0)..."
|
|
29
|
+
output = `/usr/bin/mysql -u root kinton 2>&1 < /usr/share/doc/abiquo-server/database/kinton-premium-delta-1.6.8-to-1.7.0.sql`
|
|
30
|
+
if $? != 0
|
|
31
|
+
log.error "Upgrading database schema failed: #{output}"
|
|
32
|
+
log.error "Aborting the upgrade."
|
|
33
|
+
exit 1
|
|
34
|
+
end
|
|
35
|
+
log.info "Done!"
|
|
36
|
+
|
|
37
|
+
FileUtils.rm '/opt/abiquo/config/.needsupgrade'
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: abiquo-etk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 91
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 4
|
|
9
|
-
-
|
|
10
|
-
version: 0.4.
|
|
9
|
+
- 42
|
|
10
|
+
version: 0.4.42
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Sergio Rubio
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date:
|
|
18
|
+
date: 2011-03-09 00:00:00 +01:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -78,12 +78,28 @@ dependencies:
|
|
|
78
78
|
version: "1.2"
|
|
79
79
|
type: :runtime
|
|
80
80
|
version_requirements: *id004
|
|
81
|
+
- !ruby/object:Gem::Dependency
|
|
82
|
+
name: iniparse
|
|
83
|
+
prerelease: false
|
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
|
85
|
+
none: false
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
hash: 27
|
|
90
|
+
segments:
|
|
91
|
+
- 1
|
|
92
|
+
- 1
|
|
93
|
+
- 4
|
|
94
|
+
version: 1.1.4
|
|
95
|
+
type: :runtime
|
|
96
|
+
version_requirements: *id005
|
|
81
97
|
description: Tools to troubleshoot and manage your Abiquo installation
|
|
82
98
|
email: srubio@abiquo.com
|
|
83
99
|
executables:
|
|
84
|
-
- abiquo-check-16-install
|
|
85
100
|
- abicli
|
|
86
101
|
- abiquo-initenv
|
|
102
|
+
- abiquo-check-16-install
|
|
87
103
|
extensions: []
|
|
88
104
|
|
|
89
105
|
extra_rdoc_files:
|
|
@@ -92,7 +108,6 @@ extra_rdoc_files:
|
|
|
92
108
|
- TODO
|
|
93
109
|
files:
|
|
94
110
|
- .document
|
|
95
|
-
- .gitignore
|
|
96
111
|
- LICENSE
|
|
97
112
|
- README.rdoc
|
|
98
113
|
- Rakefile
|
|
@@ -105,8 +120,14 @@ files:
|
|
|
105
120
|
- bin/abiquo-initenv
|
|
106
121
|
- lib/abicli/commands/instant-deploy.rb
|
|
107
122
|
- lib/abicli/commands/remote-services-settings.rb
|
|
123
|
+
- lib/abicli/commands/remote-services-settings16.ext
|
|
124
|
+
- lib/abicli/commands/remote-services-settings17.ext
|
|
108
125
|
- lib/abicli/commands/server-settings.rb
|
|
126
|
+
- lib/abicli/commands/server-settings168.ext
|
|
127
|
+
- lib/abicli/commands/server-settings17.ext
|
|
109
128
|
- lib/abicli/commands/set.rb
|
|
129
|
+
- lib/abicli/commands/set168.ext
|
|
130
|
+
- lib/abicli/commands/set17.ext
|
|
110
131
|
- lib/abicli/commands/smoketest.rb
|
|
111
132
|
- lib/abicli/commands/upload-template.rb
|
|
112
133
|
- lib/abicli/commands/version.rb
|
|
@@ -123,6 +144,7 @@ files:
|
|
|
123
144
|
- lib/checks/nfs.rb
|
|
124
145
|
- lib/checks/os_version.rb
|
|
125
146
|
- lib/checks/virtualbox.rb
|
|
147
|
+
- lib/upgrades/17-nuclear-launch
|
|
126
148
|
- scripts/setup_rs
|
|
127
149
|
- scripts/setup_v2v
|
|
128
150
|
- vendor/activesupport-2.3.8/CHANGELOG
|
|
@@ -624,8 +646,8 @@ homepage: http://github.com/abiquo/abiquo-etk
|
|
|
624
646
|
licenses: []
|
|
625
647
|
|
|
626
648
|
post_install_message:
|
|
627
|
-
rdoc_options:
|
|
628
|
-
|
|
649
|
+
rdoc_options: []
|
|
650
|
+
|
|
629
651
|
require_paths:
|
|
630
652
|
- lib
|
|
631
653
|
required_ruby_version: !ruby/object:Gem::Requirement
|