Sha256: 323a160e3326b0eabb277b020fdaf210822e783eb99030998efba997fdd205af

Contents?: true

Size: 1.14 KB

Versions: 18

Compression:

Stored size: 1.14 KB

Contents

module Kontena::Cli::Nodes::Azure
  class RestartCommand < Clamp::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    parameter "NAME", "Node name"
    option "--subscription-id", "SUBSCRIPTION ID", "Azure subscription id", required: true
    option "--subscription-cert", "CERTIFICATE", "Path to Azure management certificate", attribute_name: :certificate, required: true

    def execute
      require_api_url
      require_current_grid

      require 'kontena/machine/azure'

      client = ::Azure
      client.management_certificate = certificate
      client.subscription_id        = subscription_id

      client.vm_management.initialize_external_logger(Kontena::Machine::Azure::Logger.new) # We don't want all the output
      ShellSpinner "Restarting Azure VM #{name.colorize(:cyan)} " do
        vm = client.vm_management.get_virtual_machine(name, "kontena-#{current_grid}-#{name}")
        if vm
          client.vm_management.restart_virtual_machine(name, "kontena-#{current_grid}-#{name}")
        else
          abort "\nCannot find Virtual Machine #{name.colorize(:cyan)} in Azure"
        end
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
kontena-cli-0.14.7 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.14.6 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.14.5 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.14.4 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.14.3 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.14.2 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.14.1 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.14.0 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.13.4 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.13.3 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.13.2 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.13.1 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.13.0.1 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.13.0 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.12.3 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.12.2 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.12.1 lib/kontena/cli/nodes/azure/restart_command.rb
kontena-cli-0.12.0 lib/kontena/cli/nodes/azure/restart_command.rb