Module: VagrantPlugins::Vultr::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-vultr/action.rb,
lib/vagrant-vultr/action/create.rb,
lib/vagrant-vultr/action/reload.rb,
lib/vagrant-vultr/action/destroy.rb,
lib/vagrant-vultr/action/power_on.rb,
lib/vagrant-vultr/action/power_off.rb,
lib/vagrant-vultr/action/check_state.rb,
lib/vagrant-vultr/action/setup_ssh_key.rb

Defined Under Namespace

Classes: CheckState, Create, Destroy, PowerOff, PowerOn, Reload, SetupSSHKey

Class Method Summary collapse

Class Method Details

.destroyObject



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/vagrant-vultr/action.rb', line 69

def self.destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, CheckState do |env, b2|
      case env[:machine_state]
      when :active, :off
        b2.use Destroy
      when :not_created
        env[:ui].info 'Machine is not created.'
      end
    end
  end
end

.haltObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vagrant-vultr/action.rb', line 35

def self.halt
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, CheckState do |env, b2|
      case env[:machine_state]
      when :active
        b2.use PowerOff
      when :off
        env[:ui].info 'Machine is not booted.'
      when :not_created
        env[:ui].info 'Machine is not created.'
      end
    end
  end
end

.provisionObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/vagrant-vultr/action.rb', line 83

def self.provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, CheckState do |env, b2|
      case env[:machine_state]
      when :active
        b2.use Provision
      when :off
        env[:ui].info 'Machine is not booted.'
      when :not_created
        env[:ui].info 'Machine is not created.'
      end
    end
  end
end

.reloadObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vagrant-vultr/action.rb', line 51

def self.reload
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, CheckState do |env, b2|
      case env[:machine_state]
      when :active
        b2.use Reload
        b2.use Provision
        b2.use SyncedFolders
      when :off
        env[:ui].info 'Machine is not booted.'
      when :not_created
        env[:ui].info 'Machine is not created.'
      end
    end
  end
end

.sshObject



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/vagrant-vultr/action.rb', line 99

def self.ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, CheckState do |env, b2|
      case env[:machine_state]
      when :active
        b2.use SSHExec
      when :off
        env[:ui].info 'Machine is not booted.'
      when :not_created
        env[:ui].info 'Machine is not created.'
      end
    end
  end
end

.ssh_runObject



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/vagrant-vultr/action.rb', line 115

def self.ssh_run
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, CheckState do |env, b2|
      case env[:machine_state]
      when :active
        b2.use SSHRun
      when :off
        env[:ui].info 'Machine is not booted.'
      when :not_created
        env[:ui].info 'Machine is not created.'
      end
    end
  end
end

.upObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vagrant-vultr/action.rb', line 14

def self.up
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, CheckState do |env, b2|
      case env[:machine_state]
      when :active
        env[:ui].info 'Machine is already booted.'
      when :off
        b2.use PowerOn
        b2.use Provision
        b2.use SyncedFolders
      when :not_created
        b2.use SetupSSHKey
        b2.use Create
        b2.use Provision
        b2.use SyncedFolders
      end
    end
  end
end