summaryrefslogtreecommitdiffstats
path: root/cloudmasterd/lib
diff options
context:
space:
mode:
authorMatthew Hicks <mhicks@mhicks-host.usersys.redhat.com>2008-06-21 13:34:15 -0400
committerMatthew Hicks <mhicks@mhicks-host.usersys.redhat.com>2008-06-21 13:34:15 -0400
commit1bdfd2c9c90f08d8bfdd9aaebe8b558a09e08917 (patch)
tree056489c9c25ad7621f9664357e50fe59f2b763e0 /cloudmasterd/lib
parenta5937c0f25c462f14e915cce14b9ced7e4077497 (diff)
downloadtools-1bdfd2c9c90f08d8bfdd9aaebe8b558a09e08917.tar.gz
tools-1bdfd2c9c90f08d8bfdd9aaebe8b558a09e08917.tar.xz
tools-1bdfd2c9c90f08d8bfdd9aaebe8b558a09e08917.zip
Adding a db primer (for testing)
More work around the model names and db structure
Diffstat (limited to 'cloudmasterd/lib')
-rw-r--r--cloudmasterd/lib/cloudmasterd.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/cloudmasterd/lib/cloudmasterd.rb b/cloudmasterd/lib/cloudmasterd.rb
index 90e8d8a..fb761f0 100644
--- a/cloudmasterd/lib/cloudmasterd.rb
+++ b/cloudmasterd/lib/cloudmasterd.rb
@@ -84,9 +84,9 @@ module Cloudmasterd::Models
class CreateTheBasics < V 1.0
def self.up
create_table :cloudmasterd_machines do |t|
- t.column :user_email, :string, :null => false
- t.column :machine, :string, :limit => 255
- t.column :destination, :string, :limit => 255
+ t.column :name, :string, :limit => 255
+ t.column :email, :string, :null => false
+ t.column :cloud, :string, :limit => 255
end
end
def self.down
@@ -131,7 +131,7 @@ module Cloudmasterd::Controllers
@host = _get_best_host(cobbler_profile["virt_file_size"], cobbler_profile["virt_ram"])
_koan(@host, machine_fqdn, repo)
- Machine.create :user_email => email, :machine => machine_fqdn, :destination => @host
+ Machine.create :name => machine_fqdn, :email => email, :cloud => @host
render :_koan
end
end
@@ -139,8 +139,8 @@ module Cloudmasterd::Controllers
class Cloud < REST 'cloud'
def list
@machines = {}
- Machine.find(:all, :select => "distinct user_email").map{|x| x.user_email}.each do |email|
- @machines[email] = Machine.find(:all, :conditions => "user_email = '#{email}'")
+ Machine.find(:all, :select => "distinct email").map{|x| x.email}.each do |email|
+ @machines[email] = Machine.find(:all, :conditions => "email = '#{email}'")
end
render :cloud
end
@@ -175,7 +175,7 @@ module Cloudmasterd::Views
h1 email
ul do
@machines[email].each do |machine|
- li "#{machine.destination}: #{machine.machine}"
+ li "#{machine.name}: #{machine.cloud}"
end
end
end