summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Hicks <mhicks@localhost.localdomain>2008-07-16 21:43:57 -0400
committerMatt Hicks <mhicks@localhost.localdomain>2008-07-16 21:43:57 -0400
commit1255f218b548b7f7b30ad30a5aa7151d04268abc (patch)
treef3b04e9f6334198ea6f75eb663e931ecc4b09cf7
parent93c27104cd19d165c981bbedc7980b09b55109b2 (diff)
downloadtools-1255f218b548b7f7b30ad30a5aa7151d04268abc.tar.gz
tools-1255f218b548b7f7b30ad30a5aa7151d04268abc.tar.xz
tools-1255f218b548b7f7b30ad30a5aa7151d04268abc.zip
More updates to the cloudmaster and genome-bootstrap to record ip address
-rw-r--r--cloudmasterd/lib/cloudmasterd.rb63
-rw-r--r--genome-bootstrap/lib/genome-bootstrap/core.rb4
2 files changed, 36 insertions, 31 deletions
diff --git a/cloudmasterd/lib/cloudmasterd.rb b/cloudmasterd/lib/cloudmasterd.rb
index 91c4450..8d614af 100644
--- a/cloudmasterd/lib/cloudmasterd.rb
+++ b/cloudmasterd/lib/cloudmasterd.rb
@@ -108,9 +108,9 @@ module Cloudmasterd::Models
t.column :email, :string, :null => false, :limit => 255
t.column :cloud, :string, :null => false, :limit => 255
t.column :state, :string, :null => false, :limit => 255
- t.column :repo, :string, :null => false, :limit => 255
- t.column :hostname, :string, :null => false, :limit => 255
- t.column :created_date, :datetime, :null => true
+ t.column :repo, :string, :limit => 255
+ t.column :hostname, :string, :limit => 255
+ t.column :created_date, :datetime
end
end
def self.down
@@ -155,36 +155,34 @@ module Cloudmasterd::Controllers
# POST /koan
def create
- system_name = input.system_name
- repo = input.repo
- email = input.email
-
- cobbler_profile = _get_cobbler_profile(system_name, repo)
- cobbler_distro = _get_cobbler_distro(cobbler_profile["distro"], repo)
-
- # Synchronize access before making the func calls
- Syncer::lock do
- @host = _get_best_host(cobbler_profile["virt_ram"], cobbler_distro["arch"])
-
- begin
- _koan(@host, system_name, repo)
-
- @machine = Machine.create :name => system_name, :repo => repo, :email => email, :cloud => @host, :state => "Installing", :created_date => DateTime.now()
- render :_koan
- rescue Exception => e
- @exception = e
- render :_error
+ if input.machine_id
+ Machine.find(input.machine_id).update_attribute(:hostname, input.hostname)
+ else
+ system_name = input.system_name
+ repo = input.repo
+ email = input.email
+
+ cobbler_profile = _get_cobbler_profile(system_name, repo)
+ cobbler_distro = _get_cobbler_distro(cobbler_profile["distro"], repo)
+
+ # Synchronize access before making the func calls
+ Syncer::lock do
+ @host = _get_best_host(cobbler_profile["virt_ram"], cobbler_distro["arch"])
+
+ begin
+ _koan(@host, system_name, repo)
+
+ @machine = Machine.create :name => system_name, :repo => repo, :email => email, :cloud => @host, :state => "Installing", :created_date => DateTime.now()
+ render :_koan
+ rescue Exception => e
+ @exception = e
+ render :_error
+ end
end
end
end
- def update
- Machine.find(input.id).update_attribute(:hostname, input.hostname)
- end
-
def destroy(name)
- puts "Destroying image #{name}"
-
Syncer::lock do
Machine.find(:all, :conditions => "name = '#{name}'").each do |machine|
# If the machine is missing, don't bother remotely trying to cleanup
@@ -289,8 +287,15 @@ module Cloudmasterd::Views
th ''
end
@machines[email].each do |machine|
+ name = machine.hostname ? "#{machine.name} (#{machine.hostname})" : machine.name
tr do
- td machine.name
+ td do
+ if machine.repo
+ a name, :href=>"http://#{machine.repo}/genome/nodes/#{machine.name}.html"
+ else
+ a name
+ end
+ end
td machine.cloud
td machine.state
unless machine.created_date == nil then
diff --git a/genome-bootstrap/lib/genome-bootstrap/core.rb b/genome-bootstrap/lib/genome-bootstrap/core.rb
index 5c1121c..f569562 100644
--- a/genome-bootstrap/lib/genome-bootstrap/core.rb
+++ b/genome-bootstrap/lib/genome-bootstrap/core.rb
@@ -14,11 +14,11 @@
# a long with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+require 'rubygems'
require 'erb'
require 'yaml'
require 'restr'
require 'xmlrpc/client'
-require 'rubygems'
module GenomeBootstrap
class GenomeRepo
@@ -174,7 +174,7 @@ module GenomeBootstrap
end
def update_hostname(id, hostname)
- Restr.put("#{@cloud}/koan", :id => id, :hostname => hostname)
+ Restr.post("#{@cloud}/koan", :machine_id => id, :hostname => hostname)
end
end
end