Class: AETK::System

Inherits:
Object
  • Object
show all
Defined in:
lib/abiquo-etk.rb

Class Method Summary collapse

Class Method Details

.abiquo_versionObject



172
173
174
# File 'lib/abiquo-etk.rb', line 172

def self.abiquo_version
  File.read('/etc/abiquo-release').match(/Version:(.*)/)[1].strip.split(/(-|\s)/)[0].to_s.strip.chomp rescue nil
end

.detect_install_typeObject



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/abiquo-etk.rb', line 176

def self.detect_install_type
  found = ['bpm-async', 'am', 'server'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  return :monolithic if found
  
  found = ['am', 'virtualfactory', 'bpm-async'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  return :rs_plus_v2v if found
  
  found = ['am', 'virtualfactory'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  return :remote_services if found
  
  found = ['server', 'api'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  return :server if found
  
  found = ['bpm-async'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  return :v2v if found

  return :unknown

end

.detect_install_type2Object



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/abiquo-etk.rb', line 206

def self.detect_install_type2
  itype = []
  found = ['bpm-async', 'am', 'server'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  itype << :monolithic if found
  
  found = ['am', 'virtualfactory', 'bpm-async'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  itype << :rs_plus_v2v if found
  
  found = ['am', 'virtualfactory'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  itype << :remote_services if found
  
  found = ['server', 'api'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  itype << :server if found
  
  found = ['bpm-async'].each do |dir|
    break if not File.directory?(ABIQUO_BASE_DIR + "/tomcat/webapps/#{dir}")
  end
  itype << :v2v if found

  itype << :cloudnode_vbox if RPMUtils.rpm_installed?('abiquo-virtualbox')
  itype << :cloudnode_kvm if RPMUtils.rpm_installed?('abiquo-cloud-node') and \
    RPMUtils.rpm_installed?('kvm') and not RPMUtils.rpm_installed?('xen')
  itype << :cloudnode_xen if RPMUtils.rpm_installed?('abiquo-cloud-node') and \
    RPMUtils.rpm_installed?('xen')
  
  if itype.size > 0
    itype
  else
    return [:unknown]
  end
end