From e6c9122fa18af0f0e66bad3cd2d1c288a7cfa075 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 12 Jul 2011 19:24:58 +0200 Subject: [PATCH 1/3] feature #450: now install_gems does not use bundler --- share/bundler/install_gems | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/share/bundler/install_gems b/share/bundler/install_gems index a2ccb62942..f4ed69a02a 100755 --- a/share/bundler/install_gems +++ b/share/bundler/install_gems @@ -1,10 +1,26 @@ #!/usr/bin/env ruby +require 'pp' + PACKAGES=%w{optional sunstone quota cloud ozones_client ozones_server ozones_server_mysql ozones_server_sqlite} DEFAULT=%w{optional sunstone quota cloud ozones_server acct} +GROUPS={ + :optional => %w{nokogiri libxml-ruby}, + :quota => %w{sqlite3 sequel}, + :sunstone => %w{json rack sinatra thin}, + :cloud => %w{amazon-ec2 rack sinatra thin uuid curb}, + :ozones_client => %w{json}, + :ozones_server => %w{json datamapper dm-sqlite-adapter dm-mysql-adapter}, + :ozones_server_sqlite => %w{json datamapper dm-sqlite-adapter}, + :ozones_server_mysql => %w{json datamapper dm-mysql-adapter}, + :acct => %w{sequel sqlite3 mysql}, + :acct_sqlite => %w{sequel sqlite3 mysql}, + :acct_mysql => %w{sequel sqlite3 mysql} +} + class String def unindent(spaces=4) @@ -44,6 +60,12 @@ def help puts DEFAULT.join(' ') end +def get_gems(packages) + packages.map do |package| + GROUPS[package.to_sym] + end.flatten.uniq +end + try_library :rubygems, <<-EOT.unindent rubygems required to use this tool @@ -80,12 +102,10 @@ else packages=DEFAULT end -no_packages=PACKAGES-packages -no_packages<<'dummy' -without="--without #{no_packages.join(' ')}" +packages_string=get_gems(packages).join(' ') -command_string = "bundle install #{without}" +command_string = "gem install --no-ri --no-rdoc #{packages_string}" install_warning(packages) From afbd66e72efa7d0232f83ecc4936d505e1df998f Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 12 Jul 2011 19:26:36 +0200 Subject: [PATCH 2/3] Fix VmSample monitoring --- src/acct/watch_client.rb | 2 +- src/acct/watch_helper.rb | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/acct/watch_client.rb b/src/acct/watch_client.rb index 8dfd5f3ab7..6cc295a6b1 100644 --- a/src/acct/watch_client.rb +++ b/src/acct/watch_client.rb @@ -94,7 +94,7 @@ module OneWatchClient end a = Array.new - resources.group_and_count(:timestamp).collect { |row| + resources.group_and_count(:timestamp).all.each { |row| a << [row[:timestamp], row[:count].to_i] } diff --git a/src/acct/watch_helper.rb b/src/acct/watch_helper.rb index 4d0c37a446..dca1b56070 100644 --- a/src/acct/watch_helper.rb +++ b/src/acct/watch_helper.rb @@ -341,12 +341,14 @@ module WatchHelper end def self.flush - VmDelta.multi_insert(@@deltas_cache) - VmSample.multi_insert(@@samples_cache) + DB.transaction do + VmDelta.multi_insert(@@deltas_cache) + VmSample.multi_insert(@@samples_cache) + end Vm.each { |vm| if vm.samples.count > @@vm_window_size - vm.samples.last.delete + vm.samples.first.destroy end } @@ -395,11 +397,13 @@ module WatchHelper end def self.flush - HostSample.multi_insert(@@samples_cache) + DB.transaction do + HostSample.multi_insert(@@samples_cache) + end Host.all.each { |host| if host.samples.count > @@host_window_size - host.samples.first.delete + host.samples.first.destroy end } From 697ac59538a7544fe036283b6b299dbef24587a8 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 12 Jul 2011 19:27:01 +0200 Subject: [PATCH 3/3] feature #450: disable bundler gem checking --- share/bundler/install_gems | 7 ------- 1 file changed, 7 deletions(-) diff --git a/share/bundler/install_gems b/share/bundler/install_gems index f4ed69a02a..75edf783d4 100755 --- a/share/bundler/install_gems +++ b/share/bundler/install_gems @@ -83,13 +83,6 @@ try_library :rubygems, <<-EOT.unindent * Follow the instructions from http://rubygems.org/pages/download EOT -try_library :bundler, <<-EOT.unindent - bundler needed to install gems - - execute this to install it: - - [sudo] gem install bundler -EOT if ARGV.include?('-h') help