Class: Fog::Compute::Fogdocker::Server
- Inherits:
-
Server
- Object
- Server
- Fog::Compute::Fogdocker::Server
- Defined in:
- lib/fog/fogdocker/models/compute/server.rb
Overview
fog server is a docker container
Instance Attribute Summary collapse
-
#info ⇒ Object
Returns the value of attribute info.
Instance Method Summary collapse
- #commit(options = {}) ⇒ Object
- #destroy(options = {}) ⇒ Object
- #logs(options = { :stdout => 1, :stderr => 1 }) ⇒ Object
- #mac ⇒ Object
-
#ready? ⇒ Boolean
raw = “Created”=>“2014-01-16T12:42:38.081665295Z”, “Path”=>“/bin/bash”, “Args”=>[], “Config”=>{ “Hostname”=>“2ce79789656e”, “Domainname”=>“”, “User”=>“”, “Memory”=>0, “MemorySwap”=>0, “CpuShares”=>0, “AttachStdin”=>true, “AttachStdout”=>true, “AttachStderr”=>true, “PortSpecs”=>nil, “ExposedPorts”=>{, “State”=>{ “Running”=>true, “Pid”=>1505, “ExitCode”=>0, “StartedAt”=>“2014-01-16T15:50:36.304626413Z”, “FinishedAt”=>“2014-01-16T15:50:36.238743161Z”, “Ghost”=>false}, “Image”=>“7c8cf65e1efa9b55f9ba8c60a970fe41595e56b894c7fdb19871bd9b276ca9d3”, “NetworkSettings”=>{ “IPAddress”=>“172.17.0.2”, “IPPrefixLen”=>16, “Gateway”=>“172.17.42.1”, “Bridge”=>“docker0”, “PortMapping”=>nil, “Ports”=>{}}, “SysInitPath”=>“/var/lib/docker/init/dockerinit-0.7.2”, “ResolvConfPath”=>“/etc/resolv.conf”, “HostnamePath”=>“/var/lib/docker/containers/2ce79789656e4f7474624be6496dc6d988899af30d556574389a19aade2f9650/hostname”, “HostsPath”=>“/var/lib/docker/containers/2ce79789656e4f7474624be6496dc6d988899af30d556574389a19aade2f9650/hosts”, “Name”=>“/boring_engelbart”, “Driver”=>“devicemapper”, “Volumes”=>{}, “VolumesRW”=>{}, “HostConfig”=>{ “Binds”=>nil, “ContainerIDFile”=>“”, “LxcConf”=>[], “Privileged”=>false, “PortBindings”=>{}, “Links”=>nil, “PublishAllPorts”=>false} }.
- #restart(options = {}) ⇒ Object
- #save ⇒ Object
- #start(options = {}) ⇒ Object
- #stop(options = {}) ⇒ Object
- #stopped? ⇒ Boolean
- #to_s ⇒ Object
- #top(options = {}) ⇒ Object
Instance Attribute Details
#info ⇒ Object
Returns the value of attribute info.
10 11 12 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 10 def info @info end |
Instance Method Details
#commit(options = {}) ⇒ Object
109 110 111 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 109 def commit( = {}) service.container_commit({:id=>id}.merge()) end |
#destroy(options = {}) ⇒ Object
113 114 115 116 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 113 def destroy( = {}) service.container_action(:id =>id, :action => :kill) service.container_delete(:id => id) end |
#logs(options = { :stdout => 1, :stderr => 1 }) ⇒ Object
118 119 120 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 118 def logs( = { :stdout => 1, :stderr => 1 }) service.container_action(:id =>id, :action => :logs, :options => ) end |
#mac ⇒ Object
89 90 91 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 89 def mac # TODO end |
#ready? ⇒ Boolean
raw = “Created”=>“2014-01-16T12:42:38.081665295Z”, “Path”=>“/bin/bash”, “Args”=>[], “Config”=>{
"Hostname"=>"2ce79789656e",
"Domainname"=>"",
"User"=>"",
"Memory"=>0,
"MemorySwap"=>0,
"CpuShares"=>0,
"AttachStdin"=>true,
"AttachStdout"=>true,
"AttachStderr"=>true,
"PortSpecs"=>nil,
"ExposedPorts"=>{,
“State”=>{
"Running"=>true,
"Pid"=>1505,
"ExitCode"=>0,
"StartedAt"=>"2014-01-16T15:50:36.304626413Z",
"FinishedAt"=>"2014-01-16T15:50:36.238743161Z",
"Ghost"=>false},
“Image”=>“7c8cf65e1efa9b55f9ba8c60a970fe41595e56b894c7fdb19871bd9b276ca9d3”, “NetworkSettings”=>{
"IPAddress"=>"172.17.0.2",
"IPPrefixLen"=>16,
"Gateway"=>"172.17.42.1",
"Bridge"=>"docker0",
"PortMapping"=>nil,
"Ports"=>{}},
“SysInitPath”=>“/var/lib/docker/init/dockerinit-0.7.2”, “ResolvConfPath”=>“/etc/resolv.conf”, “HostnamePath”=>“/var/lib/docker/containers/2ce79789656e4f7474624be6496dc6d988899af30d556574389a19aade2f9650/hostname”, “HostsPath”=>“/var/lib/docker/containers/2ce79789656e4f7474624be6496dc6d988899af30d556574389a19aade2f9650/hosts”, “Name”=>“/boring_engelbart”, “Driver”=>“devicemapper”, “Volumes”=>{}, “VolumesRW”=>{}, “HostConfig”=>{
"Binds"=>nil,
"ContainerIDFile"=>"",
"LxcConf"=>[],
"Privileged"=>false,
"PortBindings"=>{},
"Links"=>nil,
"PublishAllPorts"=>false}
}
80 81 82 83 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 80 def ready? reload if state_running.nil? state_running end |
#restart(options = {}) ⇒ Object
104 105 106 107 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 104 def restart( = {}) service.container_action(:id =>id, :action => :restart!) reload end |
#save ⇒ Object
126 127 128 129 130 131 132 133 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 126 def save if persisted? service.container_update(attributes) else self.id = service.container_create(attributes)['id'] end reload end |
#start(options = {}) ⇒ Object
93 94 95 96 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 93 def start( = {}) service.container_action(:id =>id, :action => :start!) reload end |
#stop(options = {}) ⇒ Object
98 99 100 101 102 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 98 def stop( = {}) action = ['force'] ? :kill : :stop service.container_action(:id =>id, :action => action) reload end |
#stopped? ⇒ Boolean
85 86 87 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 85 def stopped? !ready? end |
#to_s ⇒ Object
135 136 137 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 135 def to_s name end |
#top(options = {}) ⇒ Object
122 123 124 |
# File 'lib/fog/fogdocker/models/compute/server.rb', line 122 def top( = {}) service.container_action(:id =>id, :action => :top) end |