Module: VagrantPlugins::DockerProvider::Action
- Defined in:
- lib/docker-provider/action.rb,
lib/docker-provider/action/stop.rb,
lib/docker-provider/action/start.rb,
lib/docker-provider/action/create.rb,
lib/docker-provider/action/created.rb,
lib/docker-provider/action/destroy.rb,
lib/docker-provider/action/message.rb,
lib/docker-provider/action/is_running.rb,
lib/docker-provider/action/check_running.rb,
lib/docker-provider/action/forward_ports.rb,
lib/docker-provider/action/share_folders.rb
Defined Under Namespace
Classes: CheckRunning, Create, Created, Destroy, ForwardPorts, IsRunning, Message, ShareFolders, Start, Stop
Constant Summary collapse
- Builtin =
Shortcuts
Vagrant::Action::Builtin
- Builder =
Vagrant::Action::Builder
Class Method Summary collapse
- .action_boot ⇒ Object
-
.action_destroy ⇒ Object
This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
-
.action_halt ⇒ Object
This is the action that is primarily responsible for halting the virtual machine, gracefully or by force.
-
.action_provision ⇒ Object
This action just runs the provisioners on the machine.
-
.action_reload ⇒ Object
This action is responsible for reloading the machine, which brings it down, sucks in new configuration, and brings the machine back up with the new configuration.
-
.action_ssh ⇒ Object
This is the action that will exec into an SSH shell.
-
.action_ssh_run ⇒ Object
This is the action that will run a single SSH command.
- .action_start ⇒ Object
-
.action_up ⇒ Object
This action brings the “machine” up from nothing, including creating the container, configuring metadata, and booting.
Class Method Details
.action_boot ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/docker-provider/action.rb', line 153 def self.action_boot Builder.new.tap do |b| # TODO: b.use Builtin::SetHostname b.use Start b.use Builtin::WaitForCommunicator end end |
.action_destroy ⇒ Object
This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/docker-provider/action.rb', line 100 def self.action_destroy Builder.new.tap do |b| b.use Builtin::Call, Created do |env1, b2| if !env1[:result] b2.use Message, :not_created next end b2.use Builtin::Call, Builtin::DestroyConfirm do |env2, b3| if env2[:result] b3.use Builtin::ConfigValidate b3.use Builtin::EnvSet, :force_halt => true b3.use action_halt b3.use Destroy b3.use Builtin::ProvisionerCleanup else b3.use Message, :will_not_destroy end end end end end |
.action_halt ⇒ Object
This is the action that is primarily responsible for halting the virtual machine, gracefully or by force.
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/docker-provider/action.rb', line 66 def self.action_halt Builder.new.tap do |b| b.use Builtin::Call, Created do |env, b2| if env[:result] # TODO: Make use of this once we figure out how to run dockers in machine mode # b2.use Builtin::Call, Builtin::GracefulHalt, :stopped, :running do |env2, b3| b2.use Stop else b2.use Message, :not_created end end end end |
.action_provision ⇒ Object
This action just runs the provisioners on the machine.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/docker-provider/action.rb', line 43 def self.action_provision Builder.new.tap do |b| b.use Builtin::ConfigValidate b.use Builtin::Call, Created do |env1, b2| if !env1[:result] b2.use Message, :not_created next end b2.use Builtin::Call, IsRunning do |env2, b3| if !env2[:result] b3.use Message, :not_running next end b3.use Builtin::Provision end end end end |
.action_reload ⇒ Object
This action is responsible for reloading the machine, which brings it down, sucks in new configuration, and brings the machine back up with the new configuration.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/docker-provider/action.rb', line 83 def self.action_reload Builder.new.tap do |b| b.use Builtin::Call, Created do |env1, b2| if !env1[:result] b2.use Message, :not_created next end b2.use Builtin::ConfigValidate b2.use action_halt b2.use action_start end end end |
.action_ssh ⇒ Object
This is the action that will exec into an SSH shell.
124 125 126 127 128 129 |
# File 'lib/docker-provider/action.rb', line 124 def self.action_ssh Builder.new.tap do |b| b.use CheckRunning b.use Builtin::SSHExec end end |
.action_ssh_run ⇒ Object
This is the action that will run a single SSH command.
132 133 134 135 136 137 |
# File 'lib/docker-provider/action.rb', line 132 def self.action_ssh_run Builder.new.tap do |b| b.use CheckRunning b.use Builtin::SSHRun end end |
.action_start ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/docker-provider/action.rb', line 139 def self.action_start Builder.new.tap do |b| b.use Builtin::ConfigValidate b.use Builtin::Call, IsRunning do |env, b2| # If the container is running, then our work here is done, exit next if env[:result] b2.use Builtin::Provision b2.use Message, :starting b2.use action_boot end end end |
.action_up ⇒ Object
This action brings the “machine” up from nothing, including creating the container, configuring metadata, and booting.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/docker-provider/action.rb', line 21 def self.action_up Builder.new.tap do |b| b.use Builtin::ConfigValidate b.use Builtin::Call, Created do |env, b2| if !env[:result] b2.use Builtin::HandleBoxUrl # TODO: Find out where this fits into the process # b2.use Builtin::EnvSet, :port_collision_repair => true # b2.use Builtin::HandleForwardedPortCollisions b2.use Builtin::Provision b2.use ShareFolders b2.use ForwardPorts # This will actually create and start, but that's fine b2.use Create b2.use action_boot end end b.use action_start end end |