lib/kontena/machine/upcloud/node_provisioner.rb in kontena-plugin-upcloud-0.1.0 vs lib/kontena/machine/upcloud/node_provisioner.rb in kontena-plugin-upcloud-0.2.0.pre1
- old
+ new
@@ -1,16 +1,16 @@
require 'fileutils'
require 'erb'
require 'open3'
-require 'shell-spinner'
module Kontena
module Machine
module Upcloud
class NodeProvisioner
include RandomName
include UpcloudCommon
+ include Kontena::Cli::ShellSpinner
attr_reader :api_client, :username, :password
# @param [Kontena::Client] api_client Kontena api client
# @param [String] upcloud_username Upcloud username
@@ -71,11 +71,11 @@
}
}
}
}.to_json
- ShellSpinner "Creating Upcloud node #{hostname.colorize(:cyan)} " do
+ spinner "Creating Upcloud node #{hostname.colorize(:cyan)} " do
response = post('server', body: device_data)
if response.has_key?(:error)
abort("\nUpcloud server creation failed (#{response[:error].fetch(:error_message, '')})")
end
@@ -86,10 +86,10 @@
sleep 5
end
end
node = nil
- ShellSpinner "Waiting for node #{hostname.colorize(:cyan)} join to grid #{opts[:grid].colorize(:cyan)} " do
+ spinner "Waiting for node #{hostname.colorize(:cyan)} join to grid #{opts[:grid].colorize(:cyan)} " do
sleep 2 until node = node_exists_in_grid?(opts[:grid], hostname)
end
set_labels(node, ["region=#{opts[:zone]}", "provider=upcloud"])
end