Class: Vx::ContainerConnector::Docker::Spawner
- Inherits:
-
Object
- Object
- Vx::ContainerConnector::Docker::Spawner
- Defined in:
- lib/vx/container_connector/docker/spawner.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#ssh ⇒ Object
readonly
Returns the value of attribute ssh.
-
#work_dir ⇒ Object
readonly
Returns the value of attribute work_dir.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(container, ssh, work_dir) ⇒ Spawner
constructor
A new instance of Spawner.
- #spawn(*args, &logger) ⇒ Object
Constructor Details
#initialize(container, ssh, work_dir) ⇒ Spawner
Returns a new instance of Spawner.
9 10 11 12 13 |
# File 'lib/vx/container_connector/docker/spawner.rb', line 9 def initialize(container, ssh, work_dir) @container = container @ssh = ssh @work_dir = work_dir end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
7 8 9 |
# File 'lib/vx/container_connector/docker/spawner.rb', line 7 def container @container end |
#ssh ⇒ Object (readonly)
Returns the value of attribute ssh.
7 8 9 |
# File 'lib/vx/container_connector/docker/spawner.rb', line 7 def ssh @ssh end |
#work_dir ⇒ Object (readonly)
Returns the value of attribute work_dir.
7 8 9 |
# File 'lib/vx/container_connector/docker/spawner.rb', line 7 def work_dir @work_dir end |
Instance Method Details
#id ⇒ Object
25 26 27 |
# File 'lib/vx/container_connector/docker/spawner.rb', line 25 def id container.id end |
#spawn(*args, &logger) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/vx/container_connector/docker/spawner.rb', line 15 def spawn(*args, &logger) env = args.first.is_a?(Hash) ? args.shift : {} = args.last.is_a?(Hash) ? args.pop : {} cmd = args .merge!(chdir: work_dir, pty: true) ssh.spawn(env, cmd, , &logger) end |