From 0ba3c7f27eef796e38bb4fc8f3a46e03960c3fec Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Thu, 10 Jul 2008 12:41:14 -0400 Subject: genome-bootstrap now calls cobbler directly to 'get_status' --- genome-bootstrap/lib/genome-bootstrap/core.rb | 39 ++++++++------------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'genome-bootstrap/lib/genome-bootstrap') diff --git a/genome-bootstrap/lib/genome-bootstrap/core.rb b/genome-bootstrap/lib/genome-bootstrap/core.rb index 6a5c6c6..d228f5a 100644 --- a/genome-bootstrap/lib/genome-bootstrap/core.rb +++ b/genome-bootstrap/lib/genome-bootstrap/core.rb @@ -114,38 +114,21 @@ module GenomeBootstrap add_system_to_cobbler(machine_fqdn, config["parameters"], email) end - # Retrive information form the /var/log/cobbler/install.log - def get_installed_systems - systems = restr_get("#{@genomed}/systems.xml")[0] - return systems["system"].map do |system| - def system.name - self["name"].to_s + def get_system_ip(system_name, max_tries=1) + status = 1.upto(max_tries) do + # Technically the yield should be after the remote call, but it would + # trip up the 'find' + yield if block_given? + + data = @cobblerd.call2("get_status")[1].find do |ip, s| + s[2] == "system:%s" % system_name && s[5] =~ /^installing/ end - def system.ip - self["ip"].to_s - end - - def system.hostname - self["hostname"].to_s - end - system + # This returns from the block + break data unless data.nil? end - end - - def get_installed_system(system_name) - systems = get_installed_systems.delete_if{|system| - system.name != system_name.to_s - } - return systems.empty? ? {} : systems[0] - end - - def cobbler_dns? - return false - end - - def register_dns_entry(ip, name) + return status.nil? ? nil : status[0] end # This is a workaround for a Restr "feature". If only one element it is -- cgit