Class BoxGrinder::ApplianceConfig
In: lib/boxgrinder-core/models/appliance-config.rb
lib/boxgrinder-core/models/appliance-config.rb
Parent: Object

Methods

Attributes

appliances  [RW] 
appliances  [RW] 
default_repos  [RW] 
default_repos  [RW] 
hardware  [R] 
hardware  [R] 
name  [RW] 
name  [RW] 
os  [R] 
os  [R] 
packages  [RW] 
packages  [RW] 
path  [R] 
path  [R] 
post  [R] 
post  [R] 
release  [RW] 
release  [RW] 
repos  [RW] 
repos  [RW] 
summary  [RW] 
summary  [RW] 
variables  [R] 
variables  [R] 
version  [RW] 
version  [RW] 

Public Class methods

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 24
24:     def initialize
25:       @name = nil
26:       @summary = nil
27: 
28:       @variables = {}
29: 
30:       @os = OpenCascade.new
31: 
32:       @os.name = nil
33:       @os.version = nil
34:       @os.password = nil
35:       @os.pae = true
36: 
37:       @hardware = OpenCascade.new
38: 
39:       @hardware.cpus = 1
40:       @hardware.memory = 256
41:       @hardware.network = 'NAT'
42:       @hardware.partitions = {"/" => {'size' => 1}}
43: 
44:       @post = {}
45: 
46:       @packages = []
47:       @appliances = []
48:       @repos = []
49: 
50:       @version = 1
51:       @release = 0
52:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 24
24:     def initialize
25:       @name = nil
26:       @summary = nil
27: 
28:       @variables = {}
29: 
30:       @os = OpenCascade.new
31: 
32:       @os.name = nil
33:       @os.version = nil
34:       @os.password = nil
35:       @os.pae = true
36: 
37:       @hardware = OpenCascade.new
38: 
39:       @hardware.cpus = 1
40:       @hardware.memory = 256
41:       @hardware.network = 'NAT'
42:       @hardware.partitions = {"/" => {'size' => 1}}
43: 
44:       @post = {}
45: 
46:       @packages = []
47:       @appliances = []
48:       @repos = []
49: 
50:       @version = 1
51:       @release = 0
52:     end

Public Instance methods

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 120
120:     def clone
121:       Marshal::load(Marshal.dump(self))
122:     end

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 120
120:     def clone
121:       Marshal::load(Marshal.dump(self))
122:     end

Returns default filesystem type for current OS

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 93
 93:     def default_filesystem_type
 94:       fs = 'ext4'
 95: 
 96:       case @os.name
 97:         when 'rhel', 'centos'
 98:           case @os.version
 99:             when '5'
100:               fs = 'ext3'
101:           end
102:       end
103: 
104:       fs
105:     end

Returns default filesystem type for current OS

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 93
 93:     def default_filesystem_type
 94:       fs = 'ext4'
 95: 
 96:       case @os.name
 97:         when 'rhel', 'centos'
 98:           case @os.version
 99:             when '5'
100:               fs = 'ext3'
101:           end
102:       end
103: 
104:       fs
105:     end

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 112
112:     def eql?(other)
113:       hash.eql?(other.hash)
114:     end

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 112
112:     def eql?(other)
113:       hash.eql?(other.hash)
114:     end

used to checking if configuration differs from previous in appliance-kickstart

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 108
108:     def hash
109:       "#{@name}-#{@summary}-#{@version}-#{@release}-#{@os.name}-#{@os.version}-#{@os.password}-#{@hardware.cpus}-#{@hardware.memory}-#{@hardware.partitions}-#{@appliances}".hash
110:     end

used to checking if configuration differs from previous in appliance-kickstart

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 108
108:     def hash
109:       "#{@name}-#{@summary}-#{@version}-#{@release}-#{@os.name}-#{@os.version}-#{@os.password}-#{@hardware.cpus}-#{@hardware.memory}-#{@hardware.partitions}-#{@appliances}".hash
110:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 69
69:     def init
70:       init_arch
71:       initialize_paths
72:       self
73:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 69
69:     def init
70:       init_arch
71:       initialize_paths
72:       self
73:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 75
75:     def init_arch
76:       @hardware.arch = `uname -m`.chomp.strip
77:       @hardware.base_arch = is64bit? ? "x86_64" : "i386"
78:       self
79:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 75
75:     def init_arch
76:       @hardware.arch = `uname -m`.chomp.strip
77:       @hardware.base_arch = is64bit? ? "x86_64" : "i386"
78:       self
79:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 81
81:     def initialize_paths
82:       @path = OpenCascade.new
83: 
84:       @path.os = "#{@os.name}/#{@os.version}"
85:       @path.main = "#{@hardware.arch}/#{@path.os}"
86:       @path.appliance = "appliances/#{@path.main}/#{@name}"
87:       @path.build = "build/#{@path.appliance}"
88: 
89:       self
90:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 81
81:     def initialize_paths
82:       @path = OpenCascade.new
83: 
84:       @path.os = "#{@os.name}/#{@os.version}"
85:       @path.main = "#{@hardware.arch}/#{@path.os}"
86:       @path.appliance = "appliances/#{@path.main}/#{@name}"
87:       @path.build = "build/#{@path.appliance}"
88: 
89:       self
90:     end

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 116
116:     def is64bit?
117:       @hardware.arch.eql?("x86_64")
118:     end

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 116
116:     def is64bit?
117:       @hardware.arch.eql?("x86_64")
118:     end

[Validate]