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] 
files  [R] 
files  [R] 
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:       @default_repos = true
45: 
46:       @post = {}
47:       @files = {}
48: 
49:       @packages = []
50:       @appliances = []
51:       @repos = []
52: 
53:       @version = 1
54:       @release = 0
55:     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:       @default_repos = true
45: 
46:       @post = {}
47:       @files = {}
48: 
49:       @packages = []
50:       @appliances = []
51:       @repos = []
52: 
53:       @version = 1
54:       @release = 0
55:     end

Public Instance methods

[Source]

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

[Source]

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

Returns default filesystem type for current OS

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 98
 98:     def default_filesystem_type
 99:       fs = 'ext4'
100: 
101: # Since RHEL 5.6 the default filesystem is ext4
102: #
103: #      case @os.name
104: #        when 'rhel', 'centos'
105: #          case @os.version
106: #            when '5'
107: #              fs = 'ext3'
108: #          end
109: #      end
110: 
111:       fs
112:     end

Returns default filesystem type for current OS

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 98
 98:     def default_filesystem_type
 99:       fs = 'ext4'
100: 
101: # Since RHEL 5.6 the default filesystem is ext4
102: #
103: #      case @os.name
104: #        when 'rhel', 'centos'
105: #          case @os.version
106: #            when '5'
107: #              fs = 'ext3'
108: #          end
109: #      end
110: 
111:       fs
112:     end

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 119
119:     def eql?(other)
120:       hash.eql?(other.hash)
121:     end

[Source]

     # File lib/boxgrinder-core/models/appliance-config.rb, line 119
119:     def eql?(other)
120:       hash.eql?(other.hash)
121:     end

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

[Source]

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

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

[Source]

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

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 73
73:     def init
74:       init_arch
75:       initialize_paths
76:       self
77:     end

[Source]

    # File lib/boxgrinder-core/models/appliance-config.rb, line 73
73:     def init
74:       init_arch
75:       initialize_paths
76:       self
77:     end

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Validate]