Class: OsCtl::Image::Operations::Builder::UseOrCreate
- Inherits:
-
OsCtl::Image::Operations::Base
- Object
- OsCtl::Image::Operations::Base
- OsCtl::Image::Operations::Builder::UseOrCreate
- Defined in:
- lib/osctl/image/operations/builder/use_or_create.rb
Instance Attribute Summary collapse
- #base_dir ⇒ String readonly
- #builder ⇒ Builder readonly
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(builder, base_dir) ⇒ UseOrCreate
constructor
A new instance of UseOrCreate.
Methods inherited from OsCtl::Image::Operations::Base
Constructor Details
#initialize(builder, base_dir) ⇒ UseOrCreate
Returns a new instance of UseOrCreate.
12 13 14 15 16 |
# File 'lib/osctl/image/operations/builder/use_or_create.rb', line 12 def initialize(builder, base_dir) super() @builder = builder @base_dir = base_dir end |
Instance Attribute Details
#base_dir ⇒ String (readonly)
10 11 12 |
# File 'lib/osctl/image/operations/builder/use_or_create.rb', line 10 def base_dir @base_dir end |
#builder ⇒ Builder (readonly)
7 8 9 |
# File 'lib/osctl/image/operations/builder/use_or_create.rb', line 7 def builder @builder end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/osctl/image/operations/builder/use_or_create.rb', line 18 def execute client = OsCtldClient.new if client.find_container(builder.ctid) client.start_container(builder.ctid) builder.load_attrs(client) Operations::Builder::WaitForNetwork.run(builder) else Operations::Builder::Create.run(builder, base_dir) end end |