Module: VagrantPlugins::Sakura::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-sakura/action.rb,
lib/vagrant-sakura/action/halt.rb,
lib/vagrant-sakura/action/reset.rb,
lib/vagrant-sakura/action/list_id.rb,
lib/vagrant-sakura/action/power_on.rb,
lib/vagrant-sakura/action/is_created.rb,
lib/vagrant-sakura/action/read_state.rb,
lib/vagrant-sakura/action/message_down.rb,
lib/vagrant-sakura/action/run_instance.rb,
lib/vagrant-sakura/action/sync_folders.rb,
lib/vagrant-sakura/action/delete_server.rb,
lib/vagrant-sakura/action/read_ssh_info.rb,
lib/vagrant-sakura/action/connect_sakura.rb,
lib/vagrant-sakura/action/message_not_created.rb,
lib/vagrant-sakura/action/message_already_created.rb,
lib/vagrant-sakura/action/message_will_not_destroy.rb

Defined Under Namespace

Classes: ConnectSakura, DeleteServer, Halt, IsCreated, ListId, MessageAlreadyCreated, MessageDown, MessageNotCreated, MessageWillNotDestroy, PowerOn, ReadSSHInfo, ReadState, Reset, RunInstance, SyncFolders

Class Method Summary collapse

Class Method Details

.action_destroyObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-sakura/action.rb', line 9

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use Call, DestroyConfirm do |env, b2|
      if env[:result]
        b2.use ConfigValidate
        b2.use ConnectSakura
        # b2.use Halt
        b2.use DeleteServer
      else
        b2.use MessageWillNotDestroy
      end
    end
  end
end

.action_haltObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vagrant-sakura/action.rb', line 24

def self.action_halt
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if env[:result]
        b2.use ConnectSakura
        b2.use Halt
      else
        b2.use MessageNotCreated
      end
    end
  end
end

.action_list_idObject



38
39
40
41
42
43
44
# File 'lib/vagrant-sakura/action.rb', line 38

def self.action_list_id
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectSakura
    b.use ListId
  end
end

.action_provisionObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vagrant-sakura/action.rb', line 46

def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectSakura
    b.use Call, ReadState do |env, b2|
      case env[:machine_state_id]
      when :up
        b2.use Provision
        b2.use SyncFolders
      when :down, :cleaning
        b2.use MessageDown
      when :not_created
        b2.use MessageNotCreated
      end
    end
  end
end

.action_read_ssh_infoObject



64
65
66
67
68
69
70
# File 'lib/vagrant-sakura/action.rb', line 64

def self.action_read_ssh_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectSakura
    b.use ReadSSHInfo
  end
end

.action_read_stateObject



72
73
74
75
76
77
78
# File 'lib/vagrant-sakura/action.rb', line 72

def self.action_read_state
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectSakura
    b.use ReadState
  end
end

.action_reloadObject



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

def self.action_reload
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectSakura
    b.use Call, ReadState do |env, b2|
      case env[:machine_state_id]
      when :up
        b2.use Reset
        b2.use action_provision
      when :down, :cleaning
        b2.use MessageDown
      when :not_created
        b2.use MessageNotCreated
      end
    end
  end
end

.action_sshObject



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

def self.action_ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectSakura
    b.use Call, ReadState do |env, b2|
      case env[:machine_state_id]
      when :up
        b2.use SSHExec
      when :down, :cleaning
        b2.use MessageDown
      when :not_created
        b2.use MessageNotCreated
      end
    end
  end
end

.action_ssh_runObject



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

def self.action_ssh_run
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectSakura
    b.use Call, ReadState do |env, b2|
      case env[:machine_state_id]
      when :up
        b2.use SSHRun
      when :down, :cleaning
        b2.use MessageDown
      when :not_created
        b2.use MessageNotCreated
      end
    end
  end
end

.action_upObject



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/vagrant-sakura/action.rb', line 132

def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use HandleBox
    b.use ConfigValidate
    b.use ConnectSakura
    b.use Call, ReadState do |env, b2|
      case env[:machine_state_id]
      when :up
        b2.use MessageAlreadyCreated
      when :down, :cleaning
        b2.use PowerOn
        b2.use Provision
      when :not_created
        b2.use RunInstance
        b2.use action_provision
      end
    end
  end
end