diff options
-rw-r--r-- | genome-bootstrap/bin/genome-bootstrap | 30 | ||||
-rw-r--r-- | genome-bootstrap/lib/genome-bootstrap/core.rb | 11 |
2 files changed, 30 insertions, 11 deletions
diff --git a/genome-bootstrap/bin/genome-bootstrap b/genome-bootstrap/bin/genome-bootstrap index 54e590f..6da5efc 100644 --- a/genome-bootstrap/bin/genome-bootstrap +++ b/genome-bootstrap/bin/genome-bootstrap @@ -25,15 +25,18 @@ Main { say_red("\nYour genome repo server is the system that serves as the") say_red("puppet master, git server, and cobbler server all in one.") - @repo = ask("Enter your Genome repo machine name (leave off the '-repo'): ") + @repo = ask("Enter your Genome repo fully qualified domain name (fqdn): ") say_red("\nYour cloud master is the server that determines where the") say_red("machine you're trying to create will be provisioned. Typically") say_red("cloud masters control several machines in a cloud. However,") say_red("cloud masters can be configured to simply manage their own disk space.") - @cloudmaster = ask("Enter your cloud master: ") + @cloudmaster = ask("Enter your cloud master fqdn: ") @email = ask("Enter your email address for cloud notifications: ") + # Allows genomed to know which cloudmaster is controlling this new machine + @facts["cloudmaster"] = @cloudmaster + say_red("\nYour cobbler system name consists of two parts") say_red("\t* a system prefix") say_red("\t* a machine type") @@ -53,8 +56,10 @@ Main { menu.choices(*@genome_repo.machines.map{|m| m.name}) end - # This might be useful is we stop using DDNS + # Nice to keep around with the machine's specification @facts["genome_machine_type"] = @machine_type + @system_name = "#{@system_prefix}-#{@machine_type}" + @facts["genome_system_name"] = @system_name say_red("\nYour cobbler profile determines the OS, the disk space, and") say_red("the amount of memory that should be allocated to the system") @@ -90,13 +95,28 @@ Main { classes = @genome_repo.classes_for(@machine_type) config = {"classes" => classes, "parameters" => @facts} - @genome_repo.register_machine(@fqdn, config) + @genome_repo.register_machine(@system_name, config) unless config_only cloud_master = CloudController.new(@cloudmaster, @genome_repo) - cloud_master.create_machine(@fqdn, @email) + host = cloud_master.create_machine(@system_name, @email) if @genome_repo.cobbler_dns? @genome_repo.register_dns_entry end + + installed_system = @genome_repo.get_installed_system(@system_name) + if not installed_system.empty? + if @genome_repo.cobbler_dns? + # register the new system with cobbler dns using the name, + # the installed_system's IP + end + fqdn = installed_system["hostname"] + say("Your new system is being provisioned on #{host}.") + say("The FQDN of new system is #{fqdn}.") + say("The IP address of the new system is #{installed_system["ip"]}.") + else + say("Your new system is being provisioned on #{host}.") + say("You can visit #{@cloudmaster.cloud} to see the status of the new system.") + end end end diff --git a/genome-bootstrap/lib/genome-bootstrap/core.rb b/genome-bootstrap/lib/genome-bootstrap/core.rb index 4b9ac94..44d70b6 100644 --- a/genome-bootstrap/lib/genome-bootstrap/core.rb +++ b/genome-bootstrap/lib/genome-bootstrap/core.rb @@ -26,8 +26,7 @@ module GenomeBootstrap def initialize(repo) @repo = repo - # Allow users to pass in just the machine-name or the fqdn - @fqdn = @repo.split(".").size > 1 ? @repo : "#{@repo}-repo.usersys.redhat.com" + @fqdn = @repo @genomed = "http://#{@fqdn}/genome" @machine_types_url = @genomed + "/machine_types.html" @@ -117,7 +116,7 @@ module GenomeBootstrap # Retrive information form the /var/log/cobbler/install.log def get_installed_systems - systems = restr_get("#{@genomed}/systems.xml") + systems = restr_get("#{@genomed}/systems.xml")[0] return systems["system"].map do |system| def system.name self["name"].to_s @@ -135,10 +134,10 @@ module GenomeBootstrap end def get_installed_system(system_name) - systems = get_installed_systems - systems.delete_if{|system| - system.name.to_s != system_name.to_s + systems = get_installed_systems.delete_if{|system| + system.name != system_name.to_s } + return systems.empty? ? {} : systems[0] end def cobbler_dns? |