Sha256: 518a4812e9f8849329284b9d7b58f1e4b70f2a0930fe4eb43a76452adef6689d

Contents?: true

Size: 1.17 KB

Versions: 54

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module VagrantPlugins
  module ProviderZone
    module Command
      # This is used to acces the zone via console, zlogin
      class ZloginConsole < Vagrant.plugin('2', :command)
        def execute
          options = {}
          opts = OptionParser.new do |o|
            o.banner = 'Usage: vagrant zone console zlogin [options]'
            o.on('--ip <host_ip>', 'Specify host IP to listen on') do |p|
              options[:ip] = p
            end
            o.on('--port <port>', 'Specify port to listen on') do |p|
              options[:port] = p
            end
          end

          argv = parse_options(opts)
          return unless argv

          unless argv.length <= 4
            @env.ui.info(opts.help)
            return
          end

          options[:port] = nil unless options[:port] =~ /\d/
          with_target_vms(argv, provider: :zone) do |machine|
            driver = machine.provider.driver
            detach = 'no'
            kill = 'no'
            exit = { detach: detach, kill: kill }
            driver.console(@env.ui, 'zlogin', options[:ip], options[:port], exit)
          end
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
vagrant-zones-0.1.98 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.97 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.96 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.94 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.93 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.92 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.91 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.90 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.89 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.88 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.87 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.86 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.85 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.84 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.83 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.82 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.81 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.80 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.79 lib/vagrant-zones/command/zlogin_console.rb
vagrant-zones-0.1.78 lib/vagrant-zones/command/zlogin_console.rb