abiquo-etk 0.5.3 → 0.5.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.8
@@ -5,12 +5,11 @@ require 'abiquo-etk'
5
5
 
6
6
  begin
7
7
  v = AETK::System.abiquo_version
8
- if v !~ /1\.7\.5/
8
+ if v !~ /1\.8(\.\d)?/
9
9
  raise Exception.new
10
10
  end
11
11
  rescue Exception => e
12
- $stderr.puts 'This version of abicli only supports Abiquo 1.7.5. Use abiquo-etk <= 0.4.42'
13
- $stderr.puts "DEBUG: #{e.message}"
12
+ $stderr.puts 'This version of abicli only supports Abiquo 1.8.X'
14
13
  exit 1
15
14
  end
16
15
 
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'socket'
3
+ require 'socket'
4
+
5
+ #
6
+ # http://coderrr.wordpress.com/2008/05/28/get-your-local-ip-address/
7
+ #
8
+ def local_ip
9
+ orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily
10
+ UDPSocket.open do |s|
11
+ s.connect '64.233.187.99', 1
12
+ s.addr.last
13
+ end
14
+ ensure
15
+ Socket.do_not_reverse_lookup = orig
16
+ end
17
+
18
+ ip = ''
19
+ begin
20
+ ip = local_ip
21
+ rescue Exception => e
22
+ puts "Could not automatically detect the IP of this host."
23
+ print "Type the IP address of this host: "
24
+ ip = $stdin.gets.strip.chomp
25
+ puts "Using #{ip} as the Cloud in a Box host address"
26
+ end
27
+
28
+ puts "Configuring the Cloud in a Box install..."
29
+ puts "Setting nfs-repository to: #{ip}:/opt/vm_repository"
30
+ `abicli set nfs-repository #{ip}:/opt/vm_repository`
31
+ puts "Setting AIM redis host to: #{ip}"
32
+ `abicli set aim-redis-host #{ip}`
33
+ puts "Restarting services..."
34
+ `service abiquo-tomcat restart > /dev/null 2>&1`
35
+ `service abiquo-aim restart > /dev/null 2>&1`
36
+ puts "Done!"
@@ -9,6 +9,10 @@ if ARGV[0] == 'remote-services-settings'
9
9
  load File.dirname(__FILE__) + "/remote-services-settings17.ext"
10
10
  elsif rel_info =~ /Version: 1\.6/
11
11
  load File.dirname(__FILE__) + "/remote-services-settings16.ext"
12
+ elsif rel_info =~ /Version: 1\.8/
13
+ load File.dirname(__FILE__) + "/remote-services-settings18.ext"
14
+ elsif rel_info =~ /Version: 2\.0/
15
+ load File.dirname(__FILE__) + "/remote-services-settings18.ext"
12
16
  else
13
17
  $stderr.puts "Abiquo release version not found. Unsupported installation."
14
18
  exit
@@ -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
@@ -9,6 +9,10 @@ if ARGV[0] == 'server-settings'
9
9
  load File.dirname(__FILE__) + "/server-settings17.ext"
10
10
  elsif rel_info =~ /Version: 1\.6/
11
11
  load File.dirname(__FILE__) + "/server-settings168.ext"
12
+ elsif rel_info =~ /Version: 1\.8/
13
+ load File.dirname(__FILE__) + "/server-settings18.ext"
14
+ elsif rel_info =~ /Version: 2\.0/
15
+ load File.dirname(__FILE__) + "/server-settings18.ext"
12
16
  else
13
17
  $stderr.puts "Abiquo release version not found. Unsupported installation."
14
18
  exit
@@ -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
@@ -5,21 +5,15 @@ if ARGV[0] == 'set'
5
5
  exit
6
6
  end
7
7
 
8
- begin
9
- v = AETK::System.abiquo_version
10
- if v !~ /1\.7\.5/
11
- raise Exception.new
12
- end
13
- rescue Exception
14
- $stderr.puts 'This version of abicli only supports Abiquo 1.7.5. Use abiquo-etk <= 0.4.42'
15
- exit 1
16
- end
17
-
18
8
  rel_info = File.read('/etc/abiquo-release')
19
9
  if rel_info =~ /Version: 1\.7/
20
10
  load File.dirname(__FILE__) + "/set17.ext"
21
11
  elsif rel_info =~ /Version: 1\.6/
22
12
  load File.dirname(__FILE__) + "/set168.ext"
13
+ elsif rel_info =~ /Version: 1\.8/
14
+ load File.dirname(__FILE__) + "/set18.ext"
15
+ elsif rel_info =~ /Version: 2\.0/
16
+ load File.dirname(__FILE__) + "/set18.ext"
23
17
  else
24
18
  $stderr.puts "Abiquo release version not found. Unsupported installation."
25
19
  exit
@@ -0,0 +1,216 @@
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&amp;useUnicode=true&amp;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['remote-services']['abiquo.virtualfactory.vmware.repositoryLocation'] = val
77
+ config.save('/opt/abiquo/config/abiquo.properties')
78
+ end
79
+
80
+ def set_cifs_repository(val)
81
+ begin
82
+ cifs_url = val
83
+ if cifs_url !~ /^cifs:/
84
+ cifs_url = "cifs:#{val}"
85
+ end
86
+ uri = URI.parse(cifs_url)
87
+ host = uri.host
88
+ path = uri.path
89
+ raise Exception.new if (path.nil? or host.nil?)
90
+ rescue
91
+ $stderr.puts 'ERROR: Invalid NFS/CIFS URI'
92
+ return
93
+ end
94
+ config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
95
+ config.save('/opt/abiquo/config/abiquo.properties.bak')
96
+ cifs_uri = "//#{host}#{path}"
97
+ config['remote-services']['abiquo.virtualfactory.hyperv.repositoryLocation'] = cifs_uri
98
+ config.save('/opt/abiquo/config/abiquo.properties')
99
+ end
100
+
101
+ def set_aim_redis_host(val)
102
+ if not File.exist? '/etc/abiquo-aim.ini'
103
+ raise Exception.new('Abiquo AIM config file not available')
104
+ end
105
+ config = IniParse.parse(File.read('/etc/abiquo-aim.ini'))
106
+ config.save('/etc/abiquo-aim.ini.bak')
107
+ if config['monitor'].nil?
108
+ raise Exception.new('Invalid Abiquo AIM config file')
109
+ end
110
+ config['monitor']['redisHost'] = val
111
+ config.save('/etc/abiquo-aim.ini')
112
+ end
113
+
114
+ def set_ontap_user(val)
115
+ config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
116
+ config['remote-services']['abiquo.storagemanager.netapp.user'] = val
117
+ config.save('/opt/abiquo/config/abiquo.properties')
118
+ end
119
+
120
+ def set_ontap_password(val)
121
+ config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
122
+ config['remote-services']['abiquo.storagemanager.netapp.password'] = val
123
+ config.save('/opt/abiquo/config/abiquo.properties')
124
+ end
125
+
126
+ def set_property(section, key, val)
127
+ config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
128
+ config.save('/opt/abiquo/config/abiquo.properties.bak')
129
+ config[section][key] = val
130
+ config.save('/opt/abiquo/config/abiquo.properties')
131
+ end
132
+
133
+ def get_property(section, key)
134
+ config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
135
+ config[section][key] rescue nil
136
+ end
137
+
138
+ $command_mappings = {
139
+ 'rabbitmq-host' => Proc.new do |val|
140
+ if get_property('remote-services', 'abiquo.rabbitmq.host')
141
+ set_property('remote-services', 'abiquo.rabbitmq.host', val)
142
+ end
143
+ if get_property('server', 'abiquo.rabbitmq.host')
144
+ set_property('server', 'abiquo.rabbitmq.host', val)
145
+ end
146
+ end,
147
+ 'session-timeout' => ['server', 'sessionTimeout'],
148
+ 'mail-server' => ['server', 'mail/server'],
149
+ 'mail-server-user' => ['server', 'mail/user'],
150
+ 'mail-server-password' => ['server', 'mail/password'],
151
+ 'nfs-repository' => Proc.new { |val| set_nfs_repository(val) },
152
+ 'cifs-repository' => Proc.new do |val|
153
+ set_cifs_repository val
154
+ end,
155
+ 'storagelink-address' => Proc.new do |val|
156
+ if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.address'
157
+ set_property('remote-services', 'abiquo.virtualfactory.storagelink.address', val)
158
+ end
159
+ end,
160
+ 'storagelink-user' => Proc.new do |val|
161
+ if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.user'
162
+ set_property('remote-services', 'abiquo.virtualfactory.storagelink.user', val)
163
+ end
164
+ end,
165
+ 'storagelink-password' => Proc.new do |val|
166
+ if get_property 'remote-services', 'abiquo.virtualfactory.storagelink.password'
167
+ set_property('remote-services', 'abiquo.virtualfactory.storagelink.password', val)
168
+ end
169
+ end,
170
+ 'database-host' => Proc.new { |val| set_database_host(val) },
171
+ 'database-user' => Proc.new { |val| set_database_user(val) },
172
+ 'database-password' => Proc.new { |val| set_database_password(val) },
173
+ 'ontap-user' => Proc.new { |val| set_ontap_user(val) },
174
+ 'ontap-password' => Proc.new { |val| set_ontap_password(val) },
175
+ 'aim-redis-host' => Proc.new { |val| set_aim_redis_host(val) }
176
+ }
177
+
178
+ def mapping_exist?(key)
179
+ $command_mappings.has_key? key
180
+ end
181
+
182
+ def mapping_has_proc?(comp)
183
+ $command_mappings[comp].is_a? Proc
184
+ end
185
+
186
+ def help
187
+ puts "\nSet Abiquo Platform properties\n\n"
188
+ puts "Available subcommands:"
189
+ $command_mappings.keys.sort.each do |cmd,proc|
190
+ puts " #{cmd}"
191
+ end
192
+ end
193
+
194
+
195
+ comp = ARGV[1]
196
+ path = ARGV[2]
197
+ val = ARGV[3]
198
+ file = nil
199
+ begin
200
+ if mapping_exist? comp
201
+ val = path
202
+ if mapping_has_proc? comp
203
+ $command_mappings[comp].call(val)
204
+ else
205
+ comp, path = $command_mappings[comp]
206
+ end
207
+ else
208
+ help
209
+ end
210
+ rescue NoMethodError => e
211
+ $stderr.puts e.message
212
+ $stderr.puts e.backtrace
213
+ $stderr.puts "\nproperty not found in component #{comp.bold}\n\n"
214
+ rescue Exception => e
215
+ $stderr.puts e.message
216
+ end
@@ -170,7 +170,7 @@ module AETK
170
170
  class System
171
171
 
172
172
  def self.abiquo_version
173
- File.read('/etc/abiquo-release').match(/Version:(.*)/)[1].to_s.strip.chomp
173
+ File.read('/etc/abiquo-release').match(/Version:(.*)/)[1].strip.split(/(-|\s)/)[0].to_s.strip.chomp rescue nil
174
174
  end
175
175
 
176
176
  def self.detect_install_type
@@ -247,7 +247,7 @@ module AETK
247
247
 
248
248
  def self.load_plugins(extra_plugins_dir = nil)
249
249
  puts "Loading plugins...".yellow.bold
250
- version = System.abiquo_version.gsub(/-(rc\d|ga|final|beta|preview|alpha)/i,'')
250
+ version = System.abiquo_version
251
251
  plugins = Dir[File.dirname(__FILE__) + "/checks/#{version}/*.rb"].sort
252
252
  if extra_plugins_dir and File.directory? extra_plugins_dir
253
253
  puts "Loading extra plugins...".yellow.bold
@@ -0,0 +1,4 @@
1
+ if not abiquo_installed?
2
+ puts "WARNING: Abiquo Platform Not Found."
3
+ end
4
+
@@ -0,0 +1,34 @@
1
+ if abiquo_installed?
2
+
3
+ def abiquo_tomcat_running?
4
+ return false if not File.exist?(TOMCAT_PID_FILE)
5
+
6
+ pid = File.read(TOMCAT_PID_FILE)
7
+ if `ps #{pid}`.lines.count > 1
8
+ return true
9
+ end
10
+ false
11
+ end
12
+
13
+ def tomcat_mem_limits
14
+ return ['unknown','unknown', 'unknown'] if not File.exist?(TOMCAT_PID_FILE)
15
+ pid = File.read(TOMCAT_PID_FILE)
16
+ `ps #{pid}` =~ /-XX:MaxPermSize=(.*?)\s/
17
+ perm_size = $1 || 'unknown'
18
+ `ps #{pid}` =~ /-Xms(.*?)\s/
19
+ xms = $1 || 'unknown'
20
+ `ps #{pid}` =~ /-Xmx(.*?)\s/
21
+ xmx = $1 || 'unknown'
22
+ [perm_size, xms, xmx]
23
+ end
24
+
25
+ puts "Abiquo Service:".bold.ljust(40) + (system_service_on?('abiquo-tomcat') ? 'Active'.green.bold : 'Disabled'.red.bold)
26
+
27
+ puts "Abiquo Tomcat Status:".bold.ljust(40) + (abiquo_tomcat_running? ? 'Running'.green.bold : "Stopped".red.bold)
28
+
29
+ if abiquo_tomcat_running?
30
+ p = tomcat_mem_limits
31
+ puts "Tomcat Mem Params:".bold.ljust(40) + "PERM: #{p[0].blue.bold} MIN: #{p[1].blue.bold} MAX: #{p[2].blue.bold}"
32
+ end
33
+
34
+ end
@@ -0,0 +1,3 @@
1
+ include AETK::OutputFormatters
2
+
3
+ two_cols('Abiquo Version:'.bold, AETK::System.abiquo_version)
@@ -0,0 +1,6 @@
1
+
2
+ if abiquo_installed?
3
+
4
+ puts "Abiquo Components:".bold.ljust(40) + (abiquo_components_installed).inspect
5
+
6
+ end
@@ -0,0 +1,10 @@
1
+
2
+
3
+ def fw_rules_defined?
4
+ not `iptables -nL | grep -iv ^chain | grep -iv ^target | grep -v ^$`.empty?
5
+ end
6
+
7
+ puts "Firewall Service:".bold.ljust(40) + (system_service_on?('iptables') ? 'Active'.yellow.bold : 'Disabled'.green.bold)
8
+
9
+ puts "Firewall Rules:".bold.ljust(40) + (fw_rules_defined? ? 'Found'.yellow.bold : "Not Found".green.bold)
10
+
@@ -0,0 +1,4 @@
1
+ #
2
+ # Helpers
3
+ #
4
+ puts "Abiquo Install:".bold.ljust(40) + AETK::System.detect_install_type2.join(',').upcase.bold.blue
@@ -0,0 +1,20 @@
1
+ if abiquo_installed?
2
+
3
+ def java_ok?
4
+ log = AETK::Log.instance
5
+ if not File.exist? JAVA_BIN
6
+ log.error "Java binary not found in #{JAVA_BIN}"
7
+ return false
8
+ end
9
+
10
+ if `java -version 2>&1 | grep '64-Bit Server'`.empty?
11
+ log.error "Java 64-Bit runtime not found"
12
+ return false
13
+ end
14
+
15
+ return true
16
+ end
17
+
18
+ puts "Java:".bold.ljust(40) + (java_ok? ? "64 Bit Runtime".green.bold : "Not Found".red.bold)
19
+
20
+ end
@@ -0,0 +1,33 @@
1
+
2
+ if abiquo_installed?
3
+
4
+ def mysqld_running?
5
+ return true if `service mysqld status`.strip.chomp != 'mysqld is stopped'
6
+ end
7
+
8
+ def mysqld_installed?
9
+ RPMUtils.rpm_installed?('mysql-server')
10
+ end
11
+
12
+ def abiquo_schema_present?
13
+ File.directory? '/var/lib/mysql/kinton'
14
+ end
15
+
16
+ def abiquo_schema_premium?
17
+ File.exist? '/var/lib/mysql/kinton/virtualimage_conversions.frm'
18
+ end
19
+
20
+
21
+ puts "MySQL Installed:".bold.ljust(40) + (mysqld_installed? ? 'Yes'.green.bold : 'No')
22
+ if mysqld_installed?
23
+ puts "MySQL Running:".bold.ljust(40) + (mysqld_running? ? 'Yes'.green.bold : 'No')
24
+ end
25
+
26
+ if mysqld_installed?
27
+ puts "Abiquo Schema:".bold.ljust(40) + (abiquo_schema_present? ? 'Present'.green.bold : 'Not Found')
28
+ if abiquo_schema_present?
29
+ puts "Abiquo Schema Type:".bold.ljust(40) + (abiquo_schema_premium? ? 'Premium':'Community')
30
+ end
31
+ end
32
+
33
+ end
@@ -0,0 +1,18 @@
1
+
2
+ if abiquo_installed?
3
+
4
+ def nfs_server_running?
5
+ return ((`exportfs`.lines.first.strip.chomp == '/opt/vm_repository') rescue false)
6
+ end
7
+
8
+ if service_installed?('nfs')
9
+ puts "NFS Server Service:".bold.ljust(40) + (system_service_on?('nfs') ? 'Active'.green.bold : 'Disabled'.yellow.bold)
10
+
11
+ if system_service_on? 'nfs'
12
+ puts "NFS Server Running:".bold.ljust(40) + (nfs_server_running? ? 'Yes'.bold.green : 'Missing exports'.bold.red)
13
+ end
14
+ else
15
+ two_cols('NFS Service:'.bold, 'Not installed')
16
+ end
17
+
18
+ end
@@ -0,0 +1,5 @@
1
+ def os_version
2
+ File.read('/etc/redhat-release').strip.chomp rescue 'Unknown'
3
+ end
4
+
5
+ puts "Host OS:".bold.ljust(40) + os_version
@@ -0,0 +1,11 @@
1
+ if abiquo_installed?
2
+
3
+ include AETK::OutputFormatters
4
+
5
+ def vbox_installed?
6
+ RPMUtils.rpm_installed? 'vboxmanage'
7
+ end
8
+
9
+ two_cols "VBoxManage:".bold, vbox_installed? ? 'Installed'.green.bold : 'Not found'.yellow.bold
10
+
11
+ end
@@ -0,0 +1,4 @@
1
+ if not abiquo_installed?
2
+ puts "WARNING: Abiquo Platform Not Found."
3
+ end
4
+
@@ -0,0 +1,34 @@
1
+ if abiquo_installed?
2
+
3
+ def abiquo_tomcat_running?
4
+ return false if not File.exist?(TOMCAT_PID_FILE)
5
+
6
+ pid = File.read(TOMCAT_PID_FILE)
7
+ if `ps #{pid}`.lines.count > 1
8
+ return true
9
+ end
10
+ false
11
+ end
12
+
13
+ def tomcat_mem_limits
14
+ return ['unknown','unknown', 'unknown'] if not File.exist?(TOMCAT_PID_FILE)
15
+ pid = File.read(TOMCAT_PID_FILE)
16
+ `ps #{pid}` =~ /-XX:MaxPermSize=(.*?)\s/
17
+ perm_size = $1 || 'unknown'
18
+ `ps #{pid}` =~ /-Xms(.*?)\s/
19
+ xms = $1 || 'unknown'
20
+ `ps #{pid}` =~ /-Xmx(.*?)\s/
21
+ xmx = $1 || 'unknown'
22
+ [perm_size, xms, xmx]
23
+ end
24
+
25
+ puts "Abiquo Service:".bold.ljust(40) + (system_service_on?('abiquo-tomcat') ? 'Active'.green.bold : 'Disabled'.red.bold)
26
+
27
+ puts "Abiquo Tomcat Status:".bold.ljust(40) + (abiquo_tomcat_running? ? 'Running'.green.bold : "Stopped".red.bold)
28
+
29
+ if abiquo_tomcat_running?
30
+ p = tomcat_mem_limits
31
+ puts "Tomcat Mem Params:".bold.ljust(40) + "PERM: #{p[0].blue.bold} MIN: #{p[1].blue.bold} MAX: #{p[2].blue.bold}"
32
+ end
33
+
34
+ end
@@ -0,0 +1,3 @@
1
+ include AETK::OutputFormatters
2
+
3
+ two_cols('Abiquo Version:'.bold, AETK::System.abiquo_version)
@@ -0,0 +1,6 @@
1
+
2
+ if abiquo_installed?
3
+
4
+ puts "Abiquo Components:".bold.ljust(40) + (abiquo_components_installed).inspect
5
+
6
+ end
@@ -0,0 +1,10 @@
1
+
2
+
3
+ def fw_rules_defined?
4
+ not `iptables -nL | grep -iv ^chain | grep -iv ^target | grep -v ^$`.empty?
5
+ end
6
+
7
+ puts "Firewall Service:".bold.ljust(40) + (system_service_on?('iptables') ? 'Active'.yellow.bold : 'Disabled'.green.bold)
8
+
9
+ puts "Firewall Rules:".bold.ljust(40) + (fw_rules_defined? ? 'Found'.yellow.bold : "Not Found".green.bold)
10
+
@@ -0,0 +1,4 @@
1
+ #
2
+ # Helpers
3
+ #
4
+ puts "Abiquo Install:".bold.ljust(40) + AETK::System.detect_install_type2.join(',').upcase.bold.blue
@@ -0,0 +1,20 @@
1
+ if abiquo_installed?
2
+
3
+ def java_ok?
4
+ log = AETK::Log.instance
5
+ if not File.exist? JAVA_BIN
6
+ log.error "Java binary not found in #{JAVA_BIN}"
7
+ return false
8
+ end
9
+
10
+ if `java -version 2>&1 | grep '64-Bit Server'`.empty?
11
+ log.error "Java 64-Bit runtime not found"
12
+ return false
13
+ end
14
+
15
+ return true
16
+ end
17
+
18
+ puts "Java:".bold.ljust(40) + (java_ok? ? "64 Bit Runtime".green.bold : "Not Found".red.bold)
19
+
20
+ end
@@ -0,0 +1,33 @@
1
+
2
+ if abiquo_installed?
3
+
4
+ def mysqld_running?
5
+ return true if `service mysqld status`.strip.chomp != 'mysqld is stopped'
6
+ end
7
+
8
+ def mysqld_installed?
9
+ RPMUtils.rpm_installed?('mysql-server')
10
+ end
11
+
12
+ def abiquo_schema_present?
13
+ File.directory? '/var/lib/mysql/kinton'
14
+ end
15
+
16
+ def abiquo_schema_premium?
17
+ File.exist? '/var/lib/mysql/kinton/virtualimage_conversions.frm'
18
+ end
19
+
20
+
21
+ puts "MySQL Installed:".bold.ljust(40) + (mysqld_installed? ? 'Yes'.green.bold : 'No')
22
+ if mysqld_installed?
23
+ puts "MySQL Running:".bold.ljust(40) + (mysqld_running? ? 'Yes'.green.bold : 'No')
24
+ end
25
+
26
+ if mysqld_installed?
27
+ puts "Abiquo Schema:".bold.ljust(40) + (abiquo_schema_present? ? 'Present'.green.bold : 'Not Found')
28
+ if abiquo_schema_present?
29
+ puts "Abiquo Schema Type:".bold.ljust(40) + (abiquo_schema_premium? ? 'Premium':'Community')
30
+ end
31
+ end
32
+
33
+ end
@@ -0,0 +1,18 @@
1
+
2
+ if abiquo_installed?
3
+
4
+ def nfs_server_running?
5
+ return ((`exportfs`.lines.first.strip.chomp == '/opt/vm_repository') rescue false)
6
+ end
7
+
8
+ if service_installed?('nfs')
9
+ puts "NFS Server Service:".bold.ljust(40) + (system_service_on?('nfs') ? 'Active'.green.bold : 'Disabled'.yellow.bold)
10
+
11
+ if system_service_on? 'nfs'
12
+ puts "NFS Server Running:".bold.ljust(40) + (nfs_server_running? ? 'Yes'.bold.green : 'Missing exports'.bold.red)
13
+ end
14
+ else
15
+ two_cols('NFS Service:'.bold, 'Not installed')
16
+ end
17
+
18
+ end
@@ -0,0 +1,5 @@
1
+ def os_version
2
+ File.read('/etc/redhat-release').strip.chomp rescue 'Unknown'
3
+ end
4
+
5
+ puts "Host OS:".bold.ljust(40) + os_version
@@ -0,0 +1,11 @@
1
+ if abiquo_installed?
2
+
3
+ include AETK::OutputFormatters
4
+
5
+ def vbox_installed?
6
+ RPMUtils.rpm_installed? 'vboxmanage'
7
+ end
8
+
9
+ two_cols "VBoxManage:".bold, vbox_installed? ? 'Installed'.green.bold : 'Not found'.yellow.bold
10
+
11
+ end
metadata CHANGED
@@ -1,112 +1,84 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: abiquo-etk
3
- version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 5
9
- - 3
10
- version: 0.5.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.8
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Sergio Rubio
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-04-20 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: nokogiri
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &17225360 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 9
30
- segments:
31
- - 1
32
- - 3
33
- version: "1.3"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rpm-utils
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *17225360
25
+ - !ruby/object:Gem::Dependency
26
+ name: rpm-utils
27
+ requirement: &17223840 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 9
45
- segments:
46
- - 0
47
- - 1
48
- version: "0.1"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0.1'
49
33
  type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: term-ansicolor
53
34
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *17223840
36
+ - !ruby/object:Gem::Dependency
37
+ name: term-ansicolor
38
+ requirement: &17236700 !ruby/object:Gem::Requirement
55
39
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 15
60
- segments:
61
- - 1
62
- - 0
63
- version: "1.0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
64
44
  type: :runtime
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: mixlib-cli
68
45
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *17236700
47
+ - !ruby/object:Gem::Dependency
48
+ name: mixlib-cli
49
+ requirement: &17234440 !ruby/object:Gem::Requirement
70
50
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 11
75
- segments:
76
- - 1
77
- - 2
78
- version: "1.2"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
79
55
  type: :runtime
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: iniparse
83
56
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *17234440
58
+ - !ruby/object:Gem::Dependency
59
+ name: iniparse
60
+ requirement: &17247160 !ruby/object:Gem::Requirement
85
61
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 27
90
- segments:
91
- - 1
92
- - 1
93
- - 4
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
94
65
  version: 1.1.4
95
66
  type: :runtime
96
- version_requirements: *id005
67
+ prerelease: false
68
+ version_requirements: *17247160
97
69
  description: Tools to troubleshoot and manage your Abiquo installation
98
70
  email: srubio@abiquo.com
99
- executables:
100
- - abiquo-check-install
71
+ executables:
101
72
  - abicli
102
73
  - abiquo-check-16-install
74
+ - abiquo-check-install
75
+ - ciab-setup
103
76
  extensions: []
104
-
105
- extra_rdoc_files:
77
+ extra_rdoc_files:
106
78
  - LICENSE
107
79
  - README.rdoc
108
80
  - TODO
109
- files:
81
+ files:
110
82
  - .document
111
83
  - LICENSE
112
84
  - README.rdoc
@@ -117,16 +89,20 @@ files:
117
89
  - bin/abicli
118
90
  - bin/abiquo-check-16-install
119
91
  - bin/abiquo-check-install
92
+ - bin/ciab-setup
120
93
  - lib/abicli/commands/instant-deploy.rb
121
94
  - lib/abicli/commands/remote-services-settings.rb
122
95
  - lib/abicli/commands/remote-services-settings16.ext
123
96
  - lib/abicli/commands/remote-services-settings17.ext
97
+ - lib/abicli/commands/remote-services-settings18.ext
124
98
  - lib/abicli/commands/server-settings.rb
125
99
  - lib/abicli/commands/server-settings168.ext
126
100
  - lib/abicli/commands/server-settings17.ext
101
+ - lib/abicli/commands/server-settings18.ext
127
102
  - lib/abicli/commands/set.rb
128
103
  - lib/abicli/commands/set168.ext
129
104
  - lib/abicli/commands/set17.ext
105
+ - lib/abicli/commands/set18.ext
130
106
  - lib/abicli/commands/smoketest.rb
131
107
  - lib/abicli/commands/upload-template.rb
132
108
  - lib/abicli/commands/version.rb
@@ -142,6 +118,28 @@ files:
142
118
  - lib/checks/1.7.5/nfs.rb
143
119
  - lib/checks/1.7.5/os_version.rb
144
120
  - lib/checks/1.7.5/virtualbox.rb
121
+ - lib/checks/1.7.6/01detect_abiquo.rb
122
+ - lib/checks/1.7.6/abiquo_service.rb
123
+ - lib/checks/1.7.6/abiquo_version.rb
124
+ - lib/checks/1.7.6/components_installed.rb
125
+ - lib/checks/1.7.6/firewall.rb
126
+ - lib/checks/1.7.6/install_type.rb
127
+ - lib/checks/1.7.6/java.rb
128
+ - lib/checks/1.7.6/mysql.rb
129
+ - lib/checks/1.7.6/nfs.rb
130
+ - lib/checks/1.7.6/os_version.rb
131
+ - lib/checks/1.7.6/virtualbox.rb
132
+ - lib/checks/1.8.0/01detect_abiquo.rb
133
+ - lib/checks/1.8.0/abiquo_service.rb
134
+ - lib/checks/1.8.0/abiquo_version.rb
135
+ - lib/checks/1.8.0/components_installed.rb
136
+ - lib/checks/1.8.0/firewall.rb
137
+ - lib/checks/1.8.0/install_type.rb
138
+ - lib/checks/1.8.0/java.rb
139
+ - lib/checks/1.8.0/mysql.rb
140
+ - lib/checks/1.8.0/nfs.rb
141
+ - lib/checks/1.8.0/os_version.rb
142
+ - lib/checks/1.8.0/virtualbox.rb
145
143
  - lib/upgrades/17-nuclear-launch
146
144
  - scripts/setup_rs
147
145
  - scripts/setup_v2v
@@ -639,39 +637,28 @@ files:
639
637
  - vendor/resourceful-1.0.1/spec/simple_sinatra_server_spec.rb
640
638
  - vendor/resourceful-1.0.1/spec/spec.opts
641
639
  - vendor/resourceful-1.0.1/spec/spec_helper.rb
642
- has_rdoc: true
643
640
  homepage: http://github.com/abiquo/abiquo-etk
644
641
  licenses: []
645
-
646
642
  post_install_message:
647
643
  rdoc_options: []
648
-
649
- require_paths:
644
+ require_paths:
650
645
  - lib
651
- required_ruby_version: !ruby/object:Gem::Requirement
646
+ required_ruby_version: !ruby/object:Gem::Requirement
652
647
  none: false
653
- requirements:
654
- - - ">="
655
- - !ruby/object:Gem::Version
656
- hash: 3
657
- segments:
658
- - 0
659
- version: "0"
660
- required_rubygems_version: !ruby/object:Gem::Requirement
648
+ requirements:
649
+ - - ! '>='
650
+ - !ruby/object:Gem::Version
651
+ version: '0'
652
+ required_rubygems_version: !ruby/object:Gem::Requirement
661
653
  none: false
662
- requirements:
663
- - - ">="
664
- - !ruby/object:Gem::Version
665
- hash: 3
666
- segments:
667
- - 0
668
- version: "0"
654
+ requirements:
655
+ - - ! '>='
656
+ - !ruby/object:Gem::Version
657
+ version: '0'
669
658
  requirements: []
670
-
671
659
  rubyforge_project:
672
- rubygems_version: 1.3.7
660
+ rubygems_version: 1.8.10
673
661
  signing_key:
674
662
  specification_version: 3
675
663
  summary: Abiquo Elite Toolkit
676
664
  test_files: []
677
-