Class: VagrantPlugins::Vultr::Provider
- Inherits:
-
Object
- Object
- VagrantPlugins::Vultr::Provider
- Includes:
- Helpers::Client
- Defined in:
- lib/vagrant-vultr/provider.rb
Instance Method Summary collapse
- #action(name) ⇒ Object
-
#initialize(machine) ⇒ Provider
constructor
A new instance of Provider.
- #ssh_info ⇒ Object
- #state ⇒ Object
Methods included from Helpers::Client
Constructor Details
#initialize(machine) ⇒ Provider
Returns a new instance of Provider.
8 9 10 11 |
# File 'lib/vagrant-vultr/provider.rb', line 8 def initialize(machine) @machine = machine @client = client end |
Instance Method Details
#action(name) ⇒ Object
13 14 15 16 |
# File 'lib/vagrant-vultr/provider.rb', line 13 def action(name) return unless Action.respond_to?(name) Action.__send__(name) end |
#ssh_info ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vagrant-vultr/provider.rb', line 35 def ssh_info server = @client.server(@machine.id) return if server['status'] != 'active' && server['power_status'] != 'running' { host: server['main_ip'], port: '22', username: 'root', PasswordAuthentication: 'no' } end |
#state ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-vultr/provider.rb', line 18 def state server = @client.server(@machine.id) if server if server['status'] == 'active' && server['power_status'] == 'running' state = :active else state = :off end else state = :not_created end long = short = state.to_s Vagrant::MachineState.new(state, short, long) end |