Class: OsCtl::ExportFS::Operations::Exportfs::Generate
- Includes:
- Lib::Utils::File
- Defined in:
- lib/osctl/exportfs/operations/exportfs/generate.rb
Overview
Generate exports file from the database for use with exportfs
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
protected
Returns the value of attribute server.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(server) ⇒ Generate
constructor
A new instance of Generate.
Methods inherited from Base
Constructor Details
#initialize(server) ⇒ Generate
Returns a new instance of Generate.
9 10 11 12 |
# File 'lib/osctl/exportfs/operations/exportfs/generate.rb', line 9 def initialize(server) super() @server = server end |
Instance Attribute Details
#server ⇒ Object (readonly, protected)
Returns the value of attribute server.
26 27 28 |
# File 'lib/osctl/exportfs/operations/exportfs/generate.rb', line 26 def server @server end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/osctl/exportfs/operations/exportfs/generate.rb', line 14 def execute cfg = server.open_config regenerate_file(server.exports_file, 0o644) do |new| cfg.exports.each do |ex| new.puts("#{ex.as} #{ex.host}(#{ex.})") end end end |