1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Jaime Melis 2011-07-18 16:18:08 +02:00
commit f4927c3163
8 changed files with 123 additions and 19 deletions

View File

@ -159,7 +159,8 @@ else
DELETE_DIRS="$MAKE_DIRS"
elif [ "$OZONES" = "yes" ]; then
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $OZONES_LOCATION"
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $OZONES_LOCATION \
$ETC_LOCATION"
DELETE_DIRS="$MAKE_DIRS"
else
@ -1058,8 +1059,8 @@ OZONES_LIB_CLIENT_CLI_HELPER_FILES="\
src/ozones/Client/lib/cli/ozones_helper/vdc_helper.rb \
src/ozones/Client/lib/cli/ozones_helper/zones_helper.rb"
OZONES_BIN_CLIENT_FILES="src/ozones/Client/bin/ovdcs \
src/ozones/Client/bin/ozones"
OZONES_BIN_CLIENT_FILES="src/ozones/Client/bin/ovdc \
src/ozones/Client/bin/ozone"
OZONES_RUBY_LIB_FILES="src/oca/ruby/OpenNebula.rb"

View File

@ -21,6 +21,42 @@ GROUPS={
:acct_mysql => %w{sequel sqlite3 mysql}
}
DISTRIBUTIONS={
:debian => {
:id => ['Ubuntu', 'Debian'],
:dependencies => {
'sqlite3' => 'libsqlite3-dev',
'mysql' => 'libmysqlclient-dev',
'curb' => 'libcurl4-openssl-dev',
'nokogiri' => 'libexpat1-dev',
'xmlparser' => %w{libxml2-dev libxslt1-dev}
},
:install_command => 'apt-get install'
},
:redhat => {
:id => ['CentOS', /^RedHat/],
:dependencies => {
'sqlite3' => 'sqlite-devel',
'mysql' => 'mysql-devel',
'curb' => 'curl-devel',
'nokogiri' => 'expat-devel',
'xmlparser' => %w{libxml2-devel libxslt-devel}
},
:install_command => 'yum install'
},
:suse => {
:id => [/^SUSE/],
:dependencies => {
'sqlite3' => 'sqlite3-devel' ,
'mysql' => 'libmysqlclient-devel',
'curb' => 'libcurl-devel',
'nokogiri' => 'libexpat-devel',
'xmlparser' => %w{libxml2-devel libxslt-devel}
},
:install_command => 'zypper install'
}
}
class String
def unindent(spaces=4)
@ -38,18 +74,13 @@ def try_library(name, error_message)
end
def install_warning(packages)
puts "Use -h for help"
puts
# puts "Use -h for help"
# puts
puts "About to install the gems for these components:"
puts "* "<<packages.join("\n* ")
puts
puts "Are you sure you want to continue? (YES/no)"
puts "Press enter to continue..."
yes=STDIN.readline
if yes.strip!="YES"
puts "Installation aborted"
exit(0)
end
end
def help
@ -66,6 +97,72 @@ def get_gems(packages)
end.flatten.uniq
end
def detect_distro
#lsb_info=`lsb_release -a`
lsb_info="Distributor ID: RedHat"
if $?!=0 && false
STDERR.puts("lsb_release command not found")
return nil
end
distribution_id=nil
lsb_info.scan(/^Distributor ID: (.*?)$/) do |m|
distribution_id=m.first.strip
end
return nil if !distribution_id
distro=nil
DISTRIBUTIONS.find do |dist, info|
info[:id].find do |dist_id|
dist_id===distribution_id
end
end
end
def get_dependencies(gems, dependencies)
deps=[]
gems.each do |gem_name|
deps<<dependencies[gem_name]
end
deps.flatten!
deps.compact!
deps
end
def install_dependencies(gems, distro)
if !distro
puts(<<-EOT.unindent(12))
Distribution not detected. Make sure you manually install the
dependencies described in Building from Source from the OpenNebula
documentation.
Press enter to continue...
EOT
else
puts "Distribution \"#{distro.first}\" detected."
deps=get_dependencies(gems, distro.last[:dependencies])
if deps.length==0
return
end
puts "About to install these dependencies:"
puts "* "<<deps.join("\n* ")
puts
puts "Press enter to continue..."
STDIN.readline
command=distro.last[:install_command]+" "<<deps.join(' ')
puts command
system command
end
end
try_library :rubygems, <<-EOT.unindent
rubygems required to use this tool
@ -83,7 +180,6 @@ try_library :rubygems, <<-EOT.unindent
* Follow the instructions from http://rubygems.org/pages/download
EOT
if ARGV.include?('-h')
help
exit(0)
@ -95,13 +191,21 @@ else
packages=DEFAULT
end
gems_list=get_gems(packages)
dist=detect_distro
install_dependencies(gems_list, dist)
packages_string=gems_list.join(' ')
packages_string=get_gems(packages).join(' ')
command_string = "gem install --no-ri --no-rdoc #{packages_string}"
install_warning(packages)
puts command_string
system command_string

View File

@ -94,7 +94,7 @@ EOT
body_str = ""
template.strip.each{|line|
template.strip.each_line{|line|
line.strip!
key,value = line.split("=")
body_str = body_str + key + "=" + URI.escape(value) + "&"
@ -261,4 +261,4 @@ EOT
OZonesClient::Error.new(e.message)
end
end
end
end

View File

@ -22,7 +22,7 @@ module OZonesHelper
if id[-1..-1] == ","
id = id[0..id.size-2]
end
[0, "#{kind.upcase} #{id} created successfully"]
[0, "ID: #{id}"]
end
end

View File

@ -15,7 +15,6 @@
#--------------------------------------------------------------------------- #
require 'OpenNebula'
require 'one_helper/onegroup_helper'
class OCAInteraction

View File

@ -267,7 +267,7 @@ class OzonesServer
else
pr.update # Rewrite proxy conf file
return [200, OZones.str_to_json(
"Resource #{kind} with id #{id} successfuly deleted")]
"Resource #{kind} with id #{id} successfully deleted")]
end
end