Class: VpsAdminOS::Converter::Container
- Inherits:
-
Object
- Object
- VpsAdminOS::Converter::Container
- Defined in:
- lib/vpsadminos-converter/container.rb
Instance Attribute Summary collapse
-
#arch ⇒ Object
Returns the value of attribute arch.
-
#autostart ⇒ Object
readonly
Returns the value of attribute autostart.
-
#cgparams ⇒ Object
readonly
Returns the value of attribute cgparams.
-
#dataset ⇒ Object
Returns the value of attribute dataset.
-
#devices ⇒ Object
readonly
Returns the value of attribute devices.
-
#distribution ⇒ Object
Returns the value of attribute distribution.
-
#dns_resolvers ⇒ Object
readonly
Returns the value of attribute dns_resolvers.
-
#group ⇒ Object
Returns the value of attribute group.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#id ⇒ Object
Returns the value of attribute id.
-
#nesting ⇒ Object
Returns the value of attribute nesting.
-
#netifs ⇒ Object
readonly
Returns the value of attribute netifs.
-
#rootfs ⇒ Object
Returns the value of attribute rootfs.
-
#user ⇒ Object
Returns the value of attribute user.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #datasets ⇒ Object
- #dump_config ⇒ Object
-
#initialize(id, user, group) ⇒ Container
constructor
A new instance of Container.
Constructor Details
#initialize(id, user, group) ⇒ Container
Returns a new instance of Container.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vpsadminos-converter/container.rb', line 7 def initialize(id, user, group) @id = id @user = user @group = group @distribution = 'unknown' @arch = `uname -m`.strip @hostname = 'ct' @nesting = false @dns_resolvers = [] @netifs = [] @cgparams = CGParams.new @devices = Devices.new @autostart = AutoStart.new end |
Instance Attribute Details
#arch ⇒ Object
Returns the value of attribute arch.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def arch @arch end |
#autostart ⇒ Object (readonly)
Returns the value of attribute autostart.
5 6 7 |
# File 'lib/vpsadminos-converter/container.rb', line 5 def autostart @autostart end |
#cgparams ⇒ Object (readonly)
Returns the value of attribute cgparams.
5 6 7 |
# File 'lib/vpsadminos-converter/container.rb', line 5 def cgparams @cgparams end |
#dataset ⇒ Object
Returns the value of attribute dataset.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def dataset @dataset end |
#devices ⇒ Object (readonly)
Returns the value of attribute devices.
5 6 7 |
# File 'lib/vpsadminos-converter/container.rb', line 5 def devices @devices end |
#distribution ⇒ Object
Returns the value of attribute distribution.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def distribution @distribution end |
#dns_resolvers ⇒ Object (readonly)
Returns the value of attribute dns_resolvers.
5 6 7 |
# File 'lib/vpsadminos-converter/container.rb', line 5 def dns_resolvers @dns_resolvers end |
#group ⇒ Object
Returns the value of attribute group.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def group @group end |
#hostname ⇒ Object
Returns the value of attribute hostname.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def hostname @hostname end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def id @id end |
#nesting ⇒ Object
Returns the value of attribute nesting.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def nesting @nesting end |
#netifs ⇒ Object (readonly)
Returns the value of attribute netifs.
5 6 7 |
# File 'lib/vpsadminos-converter/container.rb', line 5 def netifs @netifs end |
#rootfs ⇒ Object
Returns the value of attribute rootfs.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def rootfs @rootfs end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def user @user end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/vpsadminos-converter/container.rb', line 3 def version @version end |
Instance Method Details
#datasets ⇒ Object
22 23 24 25 26 |
# File 'lib/vpsadminos-converter/container.rb', line 22 def datasets return @datasets if @datasets @datasets = [dataset] + dataset.descendants end |
#dump_config ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vpsadminos-converter/container.rb', line 28 def dump_config { 'user' => user.name, 'group' => group.name, 'distribution' => distribution, 'version' => version, 'arch' => arch, 'net_interfaces' => netifs.map(&:dump), 'cgparams' => cgparams.dump, 'devices' => devices.dump, 'prlimits' => [], # TODO 'mounts' => [], # TODO 'autostart' => autostart.dump, 'hostname' => hostname, 'dns_resolvers' => dns_resolvers.empty? ? nil : dns_resolvers, 'nesting' => nesting } end |