abiquo-etk 0.4.25 → 0.4.29

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "abiquo-etk"
8
8
  gem.summary = %Q{Abiquo Elite Toolkit}
9
- gem.description = %Q{Tools to troubleshoot your Abiquo installation}
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
12
  gem.authors = ["Sergio Rubio"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.25
1
+ 0.4.29
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{abiquo-etk}
8
- s.version = "0.4.25"
8
+ s.version = "0.4.29"
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-10-27}
13
- s.description = %q{Tools to troubleshoot your Abiquo installation}
12
+ s.date = %q{2010-10-29}
13
+ s.description = %q{Tools to troubleshoot and manage your Abiquo installation}
14
14
  s.email = %q{srubio@abiquo.com}
15
- s.executables = ["abiquo-check-16-install", "aetk-setup-rs", "aetk-setup-v2v", "abicli", "aetk-setup-server"]
15
+ s.executables = ["abiquo-check-16-install", "abicli", "abiquo-initenv"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
18
18
  "README.rdoc",
@@ -30,9 +30,7 @@ Gem::Specification.new do |s|
30
30
  "abiquo-etk.spec",
31
31
  "bin/abicli",
32
32
  "bin/abiquo-check-16-install",
33
- "bin/aetk-setup-rs",
34
- "bin/aetk-setup-server",
35
- "bin/aetk-setup-v2v",
33
+ "bin/abiquo-initenv",
36
34
  "lib/abicli/commands/instant-deploy.rb",
37
35
  "lib/abicli/commands/remote-services-settings.rb",
38
36
  "lib/abicli/commands/server-settings.rb",
@@ -5,7 +5,7 @@
5
5
 
6
6
  Summary: Abiquo Elite Toolkit
7
7
  Name: rubygem-%{gemname}
8
- Version: 0.4.22
8
+ Version: 0.4.28
9
9
  Release: 1%{?dist}
10
10
  Group: Development/Languages
11
11
  License: GPLv2+ or Ruby
@@ -57,6 +57,12 @@ rm -rf %{buildroot}
57
57
 
58
58
 
59
59
  %changelog
60
+ * Fri Oct 29 2010 : Sergio Rubio <srubio@abiquo.com> - 0.4.28-1
61
+ - Updated to upstream 0.4.28
62
+
63
+ * Thu Oct 28 2010 : Sergio Rubio <srubio@abiquo.com> - 0.4.27-1
64
+ - Updated to upstream 0.4.27
65
+
60
66
  * Thu Oct 25 2010 : Sergio Rubio <srubio@abiquo.com> - 0.4.22-1
61
67
  - Updated to upstream 0.4.22
62
68
 
data/bin/abicli CHANGED
@@ -34,6 +34,10 @@ def config_get_node(cf, path)
34
34
  end
35
35
 
36
36
  def config_set_attribute(file, path, attrname, val, write_changes = false)
37
+ if not File.exist?(file)
38
+ AETK::Log.instance.error "config_set_attribute: file #{file} not found."
39
+ end
40
+
37
41
  doc = Nokogiri::XML(File.new(file))
38
42
  doc.root.xpath(path).first[attrname] = (val||'')
39
43
  if write_changes
@@ -41,6 +45,7 @@ def config_set_attribute(file, path, attrname, val, write_changes = false)
41
45
  f.puts doc.to_xml
42
46
  end
43
47
  end
48
+
44
49
  return doc
45
50
  end
46
51
 
@@ -72,7 +72,7 @@ class MyCLI
72
72
  :long => "--debug",
73
73
  :description => "Set the log level to debug",
74
74
  #:required => true,
75
- :proc => Proc.new { |l| Log.level = Logger::DEBUG }
75
+ :proc => Proc.new { |l| AETK::Log.instance.level = Logger::DEBUG }
76
76
 
77
77
  option :print_configs,
78
78
  :long => "--print-configs",
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'abiquo-etk'
5
+
6
+ def create_schemas(user = 'root', password = '')
7
+ log = AETK::Log.instance
8
+ cmd = ''
9
+ if password.strip.chomp.empty?
10
+ cmd = "mysql -u #{user} "
11
+ else
12
+ cmd = "mysql -u #{user} -p#{password} "
13
+ end
14
+
15
+ if `#{cmd} -e 'show databases'|grep kinton`.strip.chomp.empty?
16
+ cib = false
17
+ if File.exist? '/etc/abiquo-release'
18
+ if File.readlines('/etc/abiquo-release').join =~ /cloud-in-a-box/
19
+ log.info 'Cloud in a Box profile found'
20
+ cib = true
21
+ end
22
+ end
23
+ if cib
24
+ out = `mysql -u root < /usr/share/doc/abiquo-16-pocsetup/cloud-in-a-box.sql`
25
+ if $?.exitstatus == 0
26
+ log.info 'cloud-in-a-box schema imported succesfully.'
27
+ else
28
+ log.error "Error importing cloud-in-a-box schema: #{out}"
29
+ end
30
+ else
31
+ out = `mysql -u root < /usr/share/doc/abiquo-server/database/kinton-schema.sql`
32
+ if $?.exitstatus == 0
33
+ log.info 'kinton-schema imported succesfully.'
34
+ else
35
+ log.error "Error importing kinton-schema: #{out}"
36
+ end
37
+ out = `mysql -u root < /usr/share/doc/abiquo-server/database/kinton-premium-schema.sql`
38
+ if $?.exitstatus == 0
39
+ log.info 'kinton-premium-schema imported succesfully.'
40
+ else
41
+ log.error "Error importing kinton-premium-schema: #{out}"
42
+ end
43
+ end
44
+ else
45
+ log.warn 'kinton schema found. Skipping schema creation.'
46
+ end
47
+
48
+ end
49
+
50
+ def init_server_install
51
+ config_file ='/etc/sysconfig/abiquo-server'
52
+ log = AETK::Log.instance
53
+
54
+ log.info "Server install detected. Setting up the environment."
55
+ begin
56
+ if File.exist? config_file
57
+ @settings = abiquo_server_settings
58
+ else
59
+ log.error "Config file #{config_file} does not exist. Exit."
60
+ exit
61
+ end
62
+
63
+ log.info "Setting EventSink URL"
64
+ `abicli set event-sink-url http://#{@settings['abiquo_server_ip']}/server/EventSink`
65
+
66
+ log.info "Setting DB Properties"
67
+ `abicli set database-host #{@settings['abiquo_db_host']}`
68
+ `abicli set database-user root`
69
+ `abicli set database-password #{@settings['abiquo_db_password']}`
70
+ `abicli set mail-server 127.0.0.1`
71
+
72
+ log.info "Creating database schemas..."
73
+ create_schemas
74
+ rescue Exception => e
75
+ log.error "Unhandled exception: #{e.message}"
76
+ log.error "Unhandled exception: #{e.backtrace}"
77
+ end
78
+ end
79
+
80
+ def init_remote_services_install
81
+ config_file ='/etc/sysconfig/abiquo-rs'
82
+
83
+ log = AETK::Log.instance
84
+ log.info "Remote Services install detected. Setting up the environment."
85
+
86
+ begin
87
+ @settings = {}
88
+ if File.exist? config_file
89
+ @settings = abiquo_rs_settings
90
+ else
91
+ log.error "Config file #{config_file} does not exist. Exit."
92
+ exit
93
+ end
94
+ repo = @settings['abiquo_nfs_repository']
95
+ if repo =~ /localhost|127.0.0.1/
96
+ if File.exist? '/etc/sysconfig/abiquo-server'
97
+ log.info "NFS Repository points to localhost, fixing..."
98
+ s = abiquo_server_settings
99
+ repo = s['abiquo_server_ip'] + ':/opt/vm_repository'
100
+ end
101
+ end
102
+ log.info "Setting nfs-repository to #{repo}"
103
+ `abicli set nfs-repository #{repo}`
104
+ log.info "Setting cifs-repository to #{repo}"
105
+ `abicli set cifs-repository //your-cifs-server-ip-here/opt/vm_repository`
106
+
107
+ rescue Exception => e
108
+ log.error "Unhandled exception: #{e.message}"
109
+ log.error "Unhandled exception: #{e.backtrace}"
110
+ end
111
+ end
112
+
113
+ def init_v2v_install
114
+ config_file ='/etc/sysconfig/abiquo-server'
115
+ log = AETK::Log.instance
116
+ log.info "V2V install detected. Setting up the environment."
117
+ end
118
+
119
+ def init_rs_plus_v2v_install
120
+ init_remote_services_install
121
+ init_v2v_install
122
+ end
123
+
124
+ AETK::Log.instance.info "Running abiquo-initenv..."
125
+ case AETK::System.detect_install_type
126
+ when :server
127
+ init_server_install
128
+ when :remote_services
129
+ init_remote_services_install
130
+ when :v2v
131
+ init_v2v_install
132
+ when :rs_plus_v2v
133
+ init_rs_plus_v2v_install
134
+ else
135
+ AETK::Log.instance.error "Couldn't detect install type. Skipping first setup."
136
+ end
@@ -16,6 +16,18 @@ if ARGV[0] == 'instant-deploy'
16
16
  require 'uri'
17
17
  require 'fileutils'
18
18
 
19
+ class SystemCommands
20
+
21
+ def self.kvm=(path)
22
+ @@kvm = path
23
+ end
24
+
25
+ def self.kvm
26
+ @@kvm
27
+ end
28
+
29
+ end
30
+
19
31
  class HTTPDownloader
20
32
  def self.match?(uri)
21
33
  # URI.parse barfs on '<drive letter>:\\files \on\ windows'
@@ -90,8 +102,18 @@ if ARGV[0] == 'instant-deploy'
90
102
 
91
103
  option :tomcat_port,
92
104
  :long => '--tomcat-port PORT',
93
- :description => 'Forwarded Tomcat port (Default 8980',
105
+ :description => 'Forwarded Tomcat port (Default 8980)',
94
106
  :default => '8980'
107
+
108
+ option :vnc,
109
+ :long => '--vnc',
110
+ :description => 'Use VNC instead of SDL/Graphical display',
111
+ :default => false
112
+
113
+ option :vnc_display,
114
+ :long => '--vnc-display DISP',
115
+ :description => 'Use VNC display DISP',
116
+ :default => 0
95
117
 
96
118
  option :help,
97
119
  :short => "-h",
@@ -103,28 +125,55 @@ if ARGV[0] == 'instant-deploy'
103
125
  :exit => 0
104
126
  end
105
127
 
106
- def preflight_check
128
+ def pfcheck_ubuntu
129
+ if (File.read('/etc/lsb-release') !~ /DISTRIB_ID=Ubuntu/)
130
+ $stderr.puts "\nUbuntu not found. Your distribution is not supported.\n\n"
131
+ exit
132
+ end
133
+
107
134
  #
108
- # Check if this is Ubuntu
135
+ # Check if KVM installed
109
136
  #
110
- if not File.exists? '/etc/lsb-release'
111
- $stderr.puts "\nYou are not running Ubuntu. Other distributions are not supported.\n\n"
137
+ if `which /usr/bin/kvm`.strip.chomp.empty?
138
+ $stderr.puts "\nKVM not found. Install it first:\n\n"
139
+ $stderr.puts "sudo apt-get install kvm\n\n"
112
140
  exit
113
141
  end
114
- if not (File.read('/etc/lsb-release') =~ /DISTRIB_ID=Ubuntu/)
115
- $stderr.puts "\nYou are not running Ubuntu. Other distributions are not supported\n\n"
142
+
143
+ SystemCommands.kvm = '/usr/bin/kvm'
144
+ end
145
+
146
+ def pfcheck_redhat
147
+ if File.read('/etc/redhat-release') !~ /^(FrameOS|CentOS)/
148
+ $stderr.puts "\nRHEL not found. Your distribution is not supported.\n\n"
116
149
  exit
117
150
  end
118
-
151
+
119
152
  #
120
153
  # Check if KVM installed
121
154
  #
122
- if `which /usr/bin/kvm`.strip.chomp.empty?
155
+ if `which /usr/libexec/qemu-kvm`.strip.chomp.empty?
123
156
  $stderr.puts "\nKVM not found. Install it first:\n\n"
124
- $stderr.puts "sudo apt-get install kvm\n\n"
157
+ $stderr.puts "yum install kvm\n\n"
125
158
  exit
126
159
  end
127
160
 
161
+ SystemCommands.kvm = '/usr/libexec/qemu-kvm'
162
+ end
163
+
164
+ def preflight_check
165
+ #
166
+ # Check if this is Ubuntu
167
+ #
168
+ if File.exist?('/etc/lsb-release')
169
+ pfcheck_ubuntu
170
+ elsif File.exist?('/etc/redhat-release')
171
+ pfcheck_redhat
172
+ else
173
+ $stderr.puts "\nOnly Ubuntu and RHEL distributions are supported.\n\n"
174
+ exit
175
+ end
176
+
128
177
  #
129
178
  # Check if qemu-img installed
130
179
  #
@@ -142,6 +191,10 @@ if ARGV[0] == 'instant-deploy'
142
191
  mem = params[:mem]
143
192
  tomcat_port = params[:tomcat_port]
144
193
  ssh_port = params[:ssh_port]
194
+ graphics = ''
195
+ if params[:vnc]
196
+ graphics = "--vnc :#{params[:vnc_display]}"
197
+ end
145
198
  # Create target directory
146
199
  begin
147
200
  FileUtils.mkdir(target_dir)
@@ -196,16 +249,19 @@ if ARGV[0] == 'instant-deploy'
196
249
  f.puts "MEM=#{mem}"
197
250
  f.puts "TAP=vtap0"
198
251
  f.puts ""
199
- f.puts "kvm -m #{mem} -drive file=#{File.basename(disk_file)} -net user,hostfwd=tcp:0.0.0.0:#{tomcat_port}-:8080,hostfwd=tcp:0.0.0.0:#{ssh_port}-:22 -net nic -boot order=c > /dev/null"
252
+ f.puts "#{SystemCommands.kvm} #{graphics} -m $MEM -drive file=#{File.basename(disk_file)} -net user,hostfwd=tcp:0.0.0.0:#{tomcat_port}-:80,hostfwd=tcp:0.0.0.0:#{ssh_port}-:22 -net nic -boot order=c > /dev/null"
200
253
  f.puts ""
201
254
  f.puts "#"
202
255
  f.puts "# Comment the above line and uncomment this to use bridged networking."
203
256
  f.puts "# You will need to have a working bridge setup in order to use this."
204
257
  f.puts "# Update TAP variable above to fill your needs."
205
258
  f.puts "#"
206
- f.puts "#kvm -m #{mem} -drive file=#{File.basename(disk_file)} -net tap,ifname=$TAP -net nic -boot order=c > /dev/null 2>&1"
259
+ f.puts "#sudo #{SystemCommands.kvm} #{graphics} -m $MEM -drive file=#{File.basename(disk_file)} -net tap,ifname=$TAP -net nic -boot order=c > /dev/null 2>&1"
260
+ end
261
+ output = `#{SystemCommands.kvm} #{graphics} -m 1024 -drive file=#{disk_file} -net user,hostfwd=tcp:0.0.0.0:#{tomcat_port}-:80,hostfwd=tcp:0.0.0.0:#{ssh_port}-:22 -net nic -drive file=#{cdrom},media=cdrom -boot order=cd -boot once=d 2>&1 `
262
+ if $? != 0
263
+ puts "Error booting the VM: #{output}"
207
264
  end
208
- boot_vm :disk_file => disk_file, :cdrom => cdrom, :mem => mem, :tomcat_port => tomcat_port, :ssh_port => ssh_port
209
265
  end
210
266
 
211
267
  def distribution_version
@@ -214,18 +270,6 @@ if ARGV[0] == 'instant-deploy'
214
270
  version
215
271
  end
216
272
 
217
- def boot_vm(params = {})
218
- disk_file = params[:disk_file]
219
- cdrom = params[:cdrom]
220
- mem = params[:mem]
221
- tomcat_port = params[:tomcat_port]
222
- ssh_port = params[:ssh_port]
223
- output = `kvm -m 1024 -drive file=#{disk_file} -net user,hostfwd=tcp:0.0.0.0:#{tomcat_port}-:8080,hostfwd=tcp:0.0.0.0:#{ssh_port}-:22 -net nic -drive file=#{cdrom},media=cdrom -boot order=cd -boot once=d 2>&1 `
224
- if $? != 0
225
- puts "Error booting the VM: #{output}"
226
- end
227
- end
228
-
229
273
  target_dir = "abiquo-instant-deploy-#{Time.now.strftime "%s"}"
230
274
 
231
275
  trap("INT") { puts "\n\nCleaning Environment..."; exit }
@@ -246,7 +290,9 @@ if ARGV[0] == 'instant-deploy'
246
290
  puts "Building the cloud into #{target_dir.bold} directory..."
247
291
  install_iso(:target_dir => target_dir, :iso_url => url, :mem => cli.config[:mem],
248
292
  :tomcat_port => cli.config[:tomcat_port],
249
- :ssh_port => cli.config[:ssh_port]
293
+ :ssh_port => cli.config[:ssh_port],
294
+ :vnc => cli.config[:vnc],
295
+ :vnc_display => cli.config[:vnc_display]
250
296
  )
251
297
 
252
298
  end
@@ -156,7 +156,11 @@ if ARGV[0] == 'set'
156
156
  exit 0
157
157
  end
158
158
  file = File.join(ABIQUO_BASE_DIR, "config/#{comp}.xml")
159
- config_set_node(file, path, val, true)
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
160
164
  rescue NoMethodError => e
161
165
  $stderr.puts e.message
162
166
  $stderr.puts e.backtrace
@@ -24,7 +24,7 @@ if ARGV[0] == 'smoketest'
24
24
  option :port,
25
25
  :long => '--port PORT',
26
26
  :description => 'API Server Port',
27
- :default => 8080
27
+ :default => 80
28
28
 
29
29
  option :dc_name,
30
30
  :long => '--dc-name DCNAME',
@@ -69,11 +69,11 @@ if ARGV[0] == 'smoketest'
69
69
  begin
70
70
  puts "Creating Datacenter #{cli.config[:dc_name]} remote services..."
71
71
  rs = dc.remoteServices
72
- rs.create :type => 'VIRTUAL_FACTORY', :uri => 'http://localhost:8080/virtualfactory'
73
- rs.create :type => 'STORAGE_SYSTEM_MONITOR', :uri => 'http://localhost:8080/ssm'
74
- rs.create :type => 'VIRTUAL_SYSTEM_MONITOR', :uri => 'http://localhost:8080/vsm'
75
- rs.create :type => 'NODE_COLLECTOR', :uri => 'http://localhost:8080/nodecollector'
76
- rs.create :type => 'APPLIANCE_MANAGER', :uri => 'http://localhost:8080/am'
72
+ rs.create :type => 'VIRTUAL_FACTORY', :uri => 'http://localhost:80/virtualfactory'
73
+ rs.create :type => 'STORAGE_SYSTEM_MONITOR', :uri => 'http://localhost:80/ssm'
74
+ rs.create :type => 'VIRTUAL_SYSTEM_MONITOR', :uri => 'http://localhost:80/vsm'
75
+ rs.create :type => 'NODE_COLLECTOR', :uri => 'http://localhost:80/nodecollector'
76
+ rs.create :type => 'APPLIANCE_MANAGER', :uri => 'http://localhost:80/am'
77
77
  rs.create :type => 'DHCP_SERVICE', :uri => 'http://localhost:7911'
78
78
  rs.create :type => 'BPM_SERVICE', :uri => 'http://localhost:7911'
79
79
  rescue Resourceful::UnsuccessfulHttpRequestError
@@ -194,7 +194,7 @@ if ARGV[0] == 'upload-template'
194
194
 
195
195
  option :rs_url,
196
196
  :long => '--rs-url URL',
197
- :description => 'Remote Services URL (i.e. http://remote-services-ip:8080)'
197
+ :description => 'Remote Services URL (i.e. http://remote-services-ip)'
198
198
 
199
199
  option :debug,
200
200
  :long => '--debug',
@@ -29,12 +29,6 @@ ABIQUO_NODECOLLECTOR_CONFIG = '/opt/abiquo/config/nodecollector.xml'
29
29
  ABIQUO_AM_CONFIG = '/opt/abiquo/config/am.xml'
30
30
  ABIQUO_BPMASYNC_CONFIG = '/opt/abiquo/config/bpm-async.xml'
31
31
 
32
- #
33
- # INIT
34
- #
35
- Log = Logger.new "check.log"
36
- Log.level = Logger::INFO
37
-
38
32
  def abiquo_edition
39
33
  end
40
34
 
@@ -137,6 +131,15 @@ def abiquo_bpmasync_config
137
131
  end
138
132
 
139
133
  module AETK
134
+
135
+ class Log
136
+
137
+ def self.instance(file = '/var/log/abiquo-etk.log')
138
+ @@logger ||= Logger.new file
139
+ end
140
+
141
+ end
142
+
140
143
 
141
144
  module OutputFormatters
142
145
 
@@ -147,23 +150,39 @@ module AETK
147
150
  end
148
151
 
149
152
  def detect_install_type
150
- if RPMUtils.rpm_installed? 'abiquo-16-pocsetup'
151
- return :monolithic
152
- end
153
-
154
- if RPMUtils.rpm_installed? 'abiquo-remote-services'
155
- return :remote_services
156
- end
157
-
158
- if RPMUtils.rpm_installed? 'abiquo-v2v'
159
- return :remote_v2v
160
- end
153
+ AETK::System.detect_install_type
154
+ end
161
155
 
162
- if RPMUtils.rpm_installed? 'abiquo-server'
163
- return :server
164
- end
165
- return :unknown
156
+ class System
157
+ def self.detect_install_type
158
+ found = ['bpm-async', 'am', 'server'].each do |dir|
159
+ break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
160
+ end
161
+ return :monolithic if found
162
+
163
+ found = ['am', 'virtualfactory', 'bpm-async'].each do |dir|
164
+ break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
165
+ end
166
+ return :rs_plus_v2v if found
167
+
168
+ found = ['am', 'virtualfactory'].each do |dir|
169
+ break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
170
+ end
171
+ return :remote_services if found
172
+
173
+ found = ['server', 'api'].each do |dir|
174
+ break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
175
+ end
176
+ return :server if found
177
+
178
+ found = ['bpm-async'].each do |dir|
179
+ break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
180
+ end
181
+ return :v2v if found
166
182
 
183
+ return :unknown
184
+
185
+ end
167
186
  end
168
187
 
169
188
 
@@ -174,9 +193,10 @@ module AETK
174
193
  puts "Loading extra plugins...".yellow.bold
175
194
  plugins.concat( Dir[extra_plugins_dir + '/*.rb'].sort )
176
195
  end
177
- if Log.level == Logger::DEBUG
196
+ log = Log.instance
197
+ if log.level == Logger::DEBUG
178
198
  plugins.each do |p|
179
- puts " #{File.basename(p,'.rb')}..."
199
+ log.debug " #{File.basename(p,'.rb')}..."
180
200
  end
181
201
  end
182
202
  plugins.each do |p|
@@ -1,13 +1,14 @@
1
1
  if abiquo_installed?
2
2
 
3
3
  def java_ok?
4
+ log = AETK::Log.instance
4
5
  if not File.exist? JAVA_BIN
5
- Log.error "Java binary not found in #{JAVA_BIN}"
6
+ log.error "Java binary not found in #{JAVA_BIN}"
6
7
  return false
7
8
  end
8
9
 
9
10
  if `java -version 2>&1 | grep '64-Bit Server'`.empty?
10
- Log.error "Java 64-Bit runtime not found"
11
+ log.error "Java 64-Bit runtime not found"
11
12
  return false
12
13
  end
13
14
 
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: 61
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 25
10
- version: 0.4.25
9
+ - 29
10
+ version: 0.4.29
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: 2010-10-27 00:00:00 +02:00
18
+ date: 2010-10-29 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -78,14 +78,12 @@ dependencies:
78
78
  version: "1.2"
79
79
  type: :runtime
80
80
  version_requirements: *id004
81
- description: Tools to troubleshoot your Abiquo installation
81
+ description: Tools to troubleshoot and manage your Abiquo installation
82
82
  email: srubio@abiquo.com
83
83
  executables:
84
84
  - abiquo-check-16-install
85
- - aetk-setup-rs
86
- - aetk-setup-v2v
87
85
  - abicli
88
- - aetk-setup-server
86
+ - abiquo-initenv
89
87
  extensions: []
90
88
 
91
89
  extra_rdoc_files:
@@ -104,9 +102,7 @@ files:
104
102
  - abiquo-etk.spec
105
103
  - bin/abicli
106
104
  - bin/abiquo-check-16-install
107
- - bin/aetk-setup-rs
108
- - bin/aetk-setup-server
109
- - bin/aetk-setup-v2v
105
+ - bin/abiquo-initenv
110
106
  - lib/abicli/commands/instant-deploy.rb
111
107
  - lib/abicli/commands/remote-services-settings.rb
112
108
  - lib/abicli/commands/server-settings.rb
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'logger'
3
- require 'abiquo-etk'
4
-
5
- CONFIG_FILE='/etc/sysconfig/abiquo-rs'
6
-
7
- Log = Logger.new "/var/log/abiquo-etk.log"
8
- Log.level = Logger::INFO
9
-
10
- begin
11
- @settings = {}
12
- if File.exist? CONFIG_FILE
13
- @settings = abiquo_rs_settings
14
- else
15
- Log.error "Config file #{CONFIG_FILE} does not exist. Exit."
16
- exit
17
- end
18
- repo = @settings['abiquo_nfs_repository']
19
- if repo =~ /localhost|127.0.0.1/
20
- if File.exist? '/etc/sysconfig/abiquo-server'
21
- Log.info "NFS Repository points to localhost, fixing..."
22
- s = abiquo_server_settings
23
- repo = s['abiquo_server_ip'] + ':/opt/vm_repository'
24
- end
25
- end
26
- Log.info "Setting nfs-repository to #{repo}"
27
- `abicli set nfs-repository #{repo}`
28
- Log.info "Setting cifs-repository to #{repo}"
29
- `abicli set cifs-repository //your-cifs-server-ip-here/opt/vm_repository`
30
-
31
- rescue Exception => e
32
- Log.error "Unhandled exception: #{e.message}"
33
- Log.error "Unhandled exception: #{e.backtrace}"
34
- end
35
-
36
-
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'logger'
3
- require 'abiquo-etk'
4
-
5
- CONFIG_FILE='/etc/sysconfig/abiquo-server'
6
-
7
- Log = Logger.new('/var/log/abiquo-etk.log')
8
- Log.level = Logger::INFO
9
-
10
- def create_schemas(user = 'root', password = '')
11
- cmd = ''
12
- if password.strip.chomp.empty?
13
- cmd = "mysql -u #{user} "
14
- else
15
- cmd = "mysql -u #{user} -p#{password} "
16
- end
17
-
18
- if `#{cmd} -e 'show databases'|grep kinton`.strip.chomp.empty?
19
- cib = false
20
- if File.exist? '/etc/abiquo-release'
21
- if File.readlines('/etc/abiquo-release').join =~ /cloud-in-a-box/
22
- Log.info 'Cloud in a Box profile found'
23
- cib = true
24
- end
25
- end
26
- if cib
27
- out = `mysql -u root < /usr/share/doc/abiquo-16-pocsetup/cloud-in-a-box.sql`
28
- if $?.exitstatus == 0
29
- Log.info 'cloud-in-a-box schema imported succesfully.'
30
- else
31
- Log.error "Error importing cloud-in-a-box schema: #{out}"
32
- end
33
- else
34
- out = `mysql -u root < /usr/share/doc/abiquo-server/database/kinton-schema.sql`
35
- if $?.exitstatus == 0
36
- Log.info 'kinton-schema imported succesfully.'
37
- else
38
- Log.error "Error importing kinton-schema: #{out}"
39
- end
40
- out = `mysql -u root < /usr/share/doc/abiquo-server/database/kinton-premium-schema.sql`
41
- if $?.exitstatus == 0
42
- Log.info 'kinton-premium-schema imported succesfully.'
43
- else
44
- Log.error "Error importing kinton-premium-schema: #{out}"
45
- end
46
- end
47
- else
48
- Log.warn 'kinton schema found. Skipping schema creation.'
49
- end
50
-
51
- end
52
-
53
- begin
54
- if File.exist? CONFIG_FILE
55
- @settings = abiquo_server_settings
56
- else
57
- Log.error "Config file #{CONFIG_FILE} does not exist. Exit."
58
- exit
59
- end
60
-
61
- Log.info "Setting EventSink URL"
62
- `abicli set event-sink-url http://#{@settings['abiquo_server_ip']}:8080/server/EventSink`
63
-
64
- Log.info "Setting DB Properties"
65
- `abicli set database-host #{@settings['abiquo_db_host']}`
66
- `abicli set database-user root`
67
- `abicli set database-password #{@settings['abiquo_db_password']}`
68
- `abicli set mail-server 127.0.0.1`
69
-
70
- Log.info "Creating database schemas..."
71
- create_schemas
72
- rescue Exception => e
73
- Log.error "Unhandled exception: #{e.message}"
74
- Log.error "Unhandled exception: #{e.backtrace}"
75
- end
76
-
77
-
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'logger'
3
-
4
- CONFIG_FILE='/etc/sysconfig/abiquo-server'
5
-
6
- Log = Logger.new('/var/log/abiquo-etk.log')
7
- Log.level = Logger::INFO
8
-
9
- begin
10
- @settings = {}
11
- if File.exist? CONFIG_FILE
12
- File.read(CONFIG_FILE).each_line do |l|
13
- next if l.strip.chomp.empty?
14
- key,val = l.strip.chomp.split('=')
15
- @settings[key.strip.chomp] = val.strip.chomp rescue ''
16
- end
17
-
18
- else
19
- Log.error "Config file #{CONFIG_FILE} does not exist. Exit."
20
- exit
21
- end
22
-
23
- Log.info "Setting db user/password in localhost bpm-async context.xml"
24
- `sed -i 's/localhost/0\.0\.0\.0/' /opt/abiquo/tomcat/webapps/bpm-async/WEB-INF/classes/activemq.xml`
25
- `abicli set database-host #{@settings['abiquo_db_host']}`
26
- `abicli set database-user root`
27
- `abicli set database-password #{@settings['abiquo_db_password']}`
28
- rescue Exception => e
29
- Log.error "Unhandled exception: #{e.message}"
30
- Log.error "Unhandled exception: #{e.backtrace}"
31
- end
32
-
33
-