Class: OsCtld::Mount::Entry
- Inherits:
-
Object
- Object
- OsCtld::Mount::Entry
- Defined in:
- lib/osctld/mount/entry.rb
Constant Summary collapse
- PARAMS =
%i[fs mountpoint type opts automount dataset temp].freeze
Instance Attribute Summary collapse
-
#automount ⇒ Object
(also: #automount?)
readonly
Returns the value of attribute automount.
-
#dataset ⇒ Object
readonly
Returns the value of attribute dataset.
-
#in_config ⇒ Object
(also: #in_config?)
readonly
Returns the value of attribute in_config.
-
#mountpoint ⇒ Object
readonly
Returns the value of attribute mountpoint.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#temp ⇒ Object
(also: #temp?)
readonly
Returns the value of attribute temp.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.load(ct, cfg) ⇒ Object
Load from config.
Instance Method Summary collapse
-
#dump ⇒ Object
Dump to config.
-
#export ⇒ Object
Export to client.
- #fs ⇒ Object
-
#initialize(fs, mountpoint, type, opts, automount, dataset: nil, temp: false, in_config: false) ⇒ Entry
constructor
A new instance of Entry.
- #lxc_mountpoint ⇒ Object
Constructor Details
#initialize(fs, mountpoint, type, opts, automount, dataset: nil, temp: false, in_config: false) ⇒ Entry
Returns a new instance of Entry.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/osctld/mount/entry.rb', line 22 def initialize(fs, mountpoint, type, opts, automount, dataset: nil, temp: false, in_config: false) @fs = fs @mountpoint = mountpoint @type = type @opts = opts @automount = automount @dataset = dataset @temp = temp @in_config = in_config end |
Instance Attribute Details
#automount ⇒ Object (readonly) Also known as: automount?
Returns the value of attribute automount.
4 5 6 |
# File 'lib/osctld/mount/entry.rb', line 4 def automount @automount end |
#dataset ⇒ Object (readonly)
Returns the value of attribute dataset.
4 5 6 |
# File 'lib/osctld/mount/entry.rb', line 4 def dataset @dataset end |
#in_config ⇒ Object (readonly) Also known as: in_config?
Returns the value of attribute in_config.
4 5 6 |
# File 'lib/osctld/mount/entry.rb', line 4 def in_config @in_config end |
#mountpoint ⇒ Object (readonly)
Returns the value of attribute mountpoint.
4 5 6 |
# File 'lib/osctld/mount/entry.rb', line 4 def mountpoint @mountpoint end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
4 5 6 |
# File 'lib/osctld/mount/entry.rb', line 4 def opts @opts end |
#temp ⇒ Object (readonly) Also known as: temp?
Returns the value of attribute temp.
4 5 6 |
# File 'lib/osctld/mount/entry.rb', line 4 def temp @temp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/osctld/mount/entry.rb', line 4 def type @type end |
Class Method Details
.load(ct, cfg) ⇒ Object
Load from config
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/osctld/mount/entry.rb', line 7 def self.load(ct, cfg) new( cfg['fs'], cfg['mountpoint'], cfg['type'], cfg['opts'], cfg['automount'], dataset: cfg['dataset'] && OsCtl::Lib::Zfs::Dataset.new( File.join(ct.dataset.name, cfg['dataset']), base: ct.dataset.name ), temp: cfg['temporary'] ) end |
Instance Method Details
#dump ⇒ Object
Dump to config
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/osctld/mount/entry.rb', line 57 def dump { 'fs' => dataset ? nil : fs, 'mountpoint' => mountpoint, 'type' => type, 'opts' => opts, 'automount' => automount, 'dataset' => dataset && dataset.relative_name, 'temporary' => temp } end |
#export ⇒ Object
Export to client
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/osctld/mount/entry.rb', line 44 def export { fs:, mountpoint:, type:, opts:, automount:, dataset: dataset && dataset.relative_name, temporary: temp } end |
#fs ⇒ Object
33 34 35 |
# File 'lib/osctld/mount/entry.rb', line 33 def fs dataset ? dataset.private_path : @fs end |
#lxc_mountpoint ⇒ Object
37 38 39 40 41 |
# File 'lib/osctld/mount/entry.rb', line 37 def lxc_mountpoint ret = String.new(mountpoint) ret.slice!(0) while ret.start_with?('/') ret end |