| Class | BoxGrinder::ApplianceConfig |
| In: |
lib/boxgrinder-core/models/appliance-config.rb
lib/boxgrinder-core/models/appliance-config.rb |
| Parent: | Object |
| 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] |
# 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 = 'boxgrinder'
35:
36: @hardware = OpenCascade.new
37:
38: @hardware.cpus = 1
39: @hardware.memory = 256
40: @hardware.network = 'NAT'
41: @hardware.partitions = {"/" => { 'size' => 1 }}
42:
43: @post = {}
44:
45: @packages = []
46: @appliances = []
47: @repos = []
48:
49: @version = 1
50: @release = 0
51: end
# 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 = 'boxgrinder'
35:
36: @hardware = OpenCascade.new
37:
38: @hardware.cpus = 1
39: @hardware.memory = 256
40: @hardware.network = 'NAT'
41: @hardware.partitions = {"/" => { 'size' => 1 }}
42:
43: @post = {}
44:
45: @packages = []
46: @appliances = []
47: @repos = []
48:
49: @version = 1
50: @release = 0
51: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 104
104: def clone
105: Marshal::load(Marshal.dump(self))
106: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 104
104: def clone
105: Marshal::load(Marshal.dump(self))
106: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 96
96: def eql?(other)
97: hash.eql?(other.hash)
98: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 96
96: def eql?(other)
97: hash.eql?(other.hash)
98: end
used to checking if configuration differs from previous in appliance-kickstart
# File lib/boxgrinder-core/models/appliance-config.rb, line 92
92: def hash
93: "#{@name}-#{@summary}-#{@version}-#{@release}-#{@os.name}-#{@os.version}-#{@os.password}-#{@hardware.cpus}-#{@hardware.memory}-#{@hardware.partitions}-#{@appliances}".hash
94: end
used to checking if configuration differs from previous in appliance-kickstart
# File lib/boxgrinder-core/models/appliance-config.rb, line 92
92: def hash
93: "#{@name}-#{@summary}-#{@version}-#{@release}-#{@os.name}-#{@os.version}-#{@os.password}-#{@hardware.cpus}-#{@hardware.memory}-#{@hardware.partitions}-#{@appliances}".hash
94: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 68
68: def init
69: init_arch
70: initialize_paths
71: self
72: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 68
68: def init
69: init_arch
70: initialize_paths
71: self
72: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 74
74: def init_arch
75: @hardware.arch = `uname -m`.chomp.strip
76: @hardware.base_arch = is64bit? ? "x86_64" : "i386"
77: self
78: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 74
74: def init_arch
75: @hardware.arch = `uname -m`.chomp.strip
76: @hardware.base_arch = is64bit? ? "x86_64" : "i386"
77: self
78: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 80
80: def initialize_paths
81: @path = OpenCascade.new
82:
83: @path.os = "#{@os.name}/#{@os.version}"
84: @path.main = "#{@hardware.arch}/#{@path.os}"
85: @path.appliance = "appliances/#{@path.main}/#{@name}"
86: @path.build = "build/#{@path.appliance}"
87:
88: self
89: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 80
80: def initialize_paths
81: @path = OpenCascade.new
82:
83: @path.os = "#{@os.name}/#{@os.version}"
84: @path.main = "#{@hardware.arch}/#{@path.os}"
85: @path.appliance = "appliances/#{@path.main}/#{@name}"
86: @path.build = "build/#{@path.appliance}"
87:
88: self
89: end
# File lib/boxgrinder-core/models/appliance-config.rb, line 100
100: def is64bit?
101: @hardware.arch.eql?("x86_64")
102: end