Class: OsCtld::IdMap

Inherits:
OsCtl::Lib::IdMap
  • Object
show all
Defined in:
lib/osctld/id_map.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load(cfg, old_cfg = nil) ⇒ IdMap

Load map from config file

We're still backward compatible with UID/GID offsets, which are converted to a map with a single entry. Remove this in the future (TODO).

Returns:



11
12
13
14
15
16
17
18
# File 'lib/osctld/id_map.rb', line 11

def self.load(cfg, old_cfg = nil)
  if old_cfg && cfg.nil? && old_cfg['offset'] && old_cfg['size']
    new(["0:#{old_cfg['offset']}:#{old_cfg['size']}"])

  else
    new(cfg || [])
  end
end

Instance Method Details

#dumpObject

Dump the map to config file



21
22
23
# File 'lib/osctld/id_map.rb', line 21

def dump
  entries.map(&:to_s)
end

#exportObject

Export the map to clients



26
27
28
# File 'lib/osctld/id_map.rb', line 26

def export
  dump
end