Class: Conjure::Service::Volume
- Inherits:
-
Object
- Object
- Conjure::Service::Volume
- Defined in:
- lib/conjure/service/volume.rb
Instance Attribute Summary collapse
-
#container_path ⇒ Object
readonly
Returns the value of attribute container_path.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(options) ⇒ Volume
constructor
A new instance of Volume.
- #read(filename) ⇒ Object
- #shell ⇒ Object
- #write(filename, data) ⇒ Object
Constructor Details
#initialize(options) ⇒ Volume
Returns a new instance of Volume.
6 7 8 9 10 |
# File 'lib/conjure/service/volume.rb', line 6 def initialize() @target = [:target] @host_path = [:host_path] @container_path = [:container_path] end |
Instance Attribute Details
#container_path ⇒ Object (readonly)
Returns the value of attribute container_path.
4 5 6 |
# File 'lib/conjure/service/volume.rb', line 4 def container_path @container_path end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
4 5 6 |
# File 'lib/conjure/service/volume.rb', line 4 def target @target end |
Instance Method Details
#read(filename) ⇒ Object
12 13 14 |
# File 'lib/conjure/service/volume.rb', line 12 def read(filename) shell.command "cat #{@container_path}/#{filename}" end |
#shell ⇒ Object
20 21 22 23 24 25 |
# File 'lib/conjure/service/volume.rb', line 20 def shell @shell ||= @target.shell.prepare( :label => "volume", :host_volumes => {@host_path => @container_path}, ) end |
#write(filename, data) ⇒ Object
16 17 18 |
# File 'lib/conjure/service/volume.rb', line 16 def write(filename, data) shell.command "echo '#{data}' >#{@container_path}/#{filename}" end |