class Chef::Knife::ScalewayServerRename
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/scaleway_droplet_rename.rb, line 32 def run $stdout.sync = true validate! unless locate_config_value(:name) ui.error('Name cannot be empty. => -N <name>') exit 1 end unless locate_config_value(:id) ui.error('ID cannot be empty. => -I <id>') exit 1 end result = client.server_actions.rename(server_id: locate_config_value(:id), name: locate_config_value(:name)) unless result.class == DropletKit::Action ui.error JSON.parse(result)['message'] exit 1 end wait_for_status(result) end