lib/kontena/machine/azure/master_provisioner.rb in kontena-plugin-azure-0.2.0.pre1 vs lib/kontena/machine/azure/master_provisioner.rb in kontena-plugin-azure-0.2.0

- old
+ new

@@ -1,8 +1,9 @@ require 'fileutils' require 'erb' require 'open3' +require 'json' module Kontena module Machine module Azure class MasterProvisioner @@ -30,11 +31,11 @@ ssl_cert = File.read(File.expand_path(opts[:ssl_cert])) end cloud_service_name = generate_cloud_service_name vm_name = cloud_service_name master_url = '' - spinner "Creating Azure Virtual Machine #{vm_name.colorize(:cyan)}" do + spinner "Creating an Azure Virtual Machine #{vm_name.colorize(:cyan)}" do if opts[:virtual_network].nil? location = opts[:location].downcase.gsub(' ', '-') default_network_name = "kontena-#{location}" create_virtual_network(default_network_name, opts[:location]) unless virtual_network_exist?(default_network_name) opts[:virtual_network] = default_network_name @@ -81,16 +82,21 @@ spinner "Waiting for #{vm_name.colorize(:cyan)} to start" do sleep 0.5 until master_running? end - puts - puts "Kontena Master is now running at #{master_url}".colorize(:green) - puts + master_version = nil + spinner "Retrieving Kontena Master version" do + master_version = JSON.parse(@http_client.get(path: '/').body["version"]) rescue nil + end + spinner "Kontena Master #{master_version} is now running at #{master_url}".colorize(:green) + { name: opts[:name] || cloud_service_name.sub('kontena-master-', ''), public_ip: virtual_machine.ipaddress, + provider: 'azure', + version: master_version, code: opts[:initial_admin_code] } end def erb(template, vars)