Class: OsCtl::Image::Builder
- Inherits:
-
Object
- Object
- OsCtl::Image::Builder
- Defined in:
- lib/osctl/image/builder.rb
Instance Attribute Summary collapse
- #arch ⇒ String readonly
-
#attrs ⇒ Hash
readonly
Attributes returned by ‘osctl ct show`.
- #base_dir ⇒ String readonly
- #distribution ⇒ String readonly
- #name ⇒ String readonly
- #variant ⇒ String readonly
- #vendor ⇒ String readonly
- #version ⇒ String readonly
Instance Method Summary collapse
- #ctid ⇒ Object
-
#initialize(base_dir, name) ⇒ Builder
constructor
A new instance of Builder.
- #load_attrs(client = nil) ⇒ Object
- #load_config ⇒ Object
Constructor Details
#initialize(base_dir, name) ⇒ Builder
Returns a new instance of Builder.
30 31 32 33 |
# File 'lib/osctl/image/builder.rb', line 30 def initialize(base_dir, name) @base_dir = base_dir @name = name end |
Instance Attribute Details
#arch ⇒ String (readonly)
16 17 18 |
# File 'lib/osctl/image/builder.rb', line 16 def arch @arch end |
#attrs ⇒ Hash (readonly)
Attributes returned by ‘osctl ct show`
26 27 28 |
# File 'lib/osctl/image/builder.rb', line 26 def attrs @attrs end |
#base_dir ⇒ String (readonly)
4 5 6 |
# File 'lib/osctl/image/builder.rb', line 4 def base_dir @base_dir end |
#distribution ⇒ String (readonly)
10 11 12 |
# File 'lib/osctl/image/builder.rb', line 10 def distribution @distribution end |
#name ⇒ String (readonly)
7 8 9 |
# File 'lib/osctl/image/builder.rb', line 7 def name @name end |
#variant ⇒ String (readonly)
22 23 24 |
# File 'lib/osctl/image/builder.rb', line 22 def variant @variant end |
#vendor ⇒ String (readonly)
19 20 21 |
# File 'lib/osctl/image/builder.rb', line 19 def vendor @vendor end |
#version ⇒ String (readonly)
13 14 15 |
# File 'lib/osctl/image/builder.rb', line 13 def version @version end |
Instance Method Details
#ctid ⇒ Object
58 59 60 |
# File 'lib/osctl/image/builder.rb', line 58 def ctid "builder-#{name}" end |
#load_attrs(client = nil) ⇒ Object
54 55 56 |
# File 'lib/osctl/image/builder.rb', line 54 def load_attrs(client = nil) @attrs = (client || OsCtldClient.new).find_container(ctid) end |
#load_config ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/osctl/image/builder.rb', line 35 def load_config cfg = Operations::Config::ParseAttrs.run(base_dir, :builder, name) { distribution: 'DISTNAME', version: 'RELVER', arch: 'ARCH', vendor: 'VENDOR', variant: 'VARIANT' }.each do |attr, var| instance_variable_set(:"@#{attr}", cfg[var]) if cfg.has_key?(var) end @arch ||= 'x86_64' @vendor ||= 'vpsadminos' @variant ||= 'minimal' nil end |