Class: DInstaller::CockpitConfig

Inherits:
CFA::BaseModel
  • Object
show all
Defined in:
lib/dinstaller/cockpit_manager.rb

Overview

Cockpit configuration file representation

Examples:

Set the AllowUnencrypted option

file = CockpitConfig.new
file.load
file.web_service["AllowUnencrypted"] = "true"
file.save

Instance Method Summary collapse

Constructor Details

#initialize(path: DEFAULT_PATH, file_handler: nil) ⇒ CockpitConfig

Constructor

Parameters:

  • path (String) (defaults to: DEFAULT_PATH)

    File path

  • file_handler (.read, .write) (defaults to: nil)

    Object to read/write the file.



43
44
45
# File 'lib/dinstaller/cockpit_manager.rb', line 43

def initialize(path: DEFAULT_PATH, file_handler: nil)
  super(CFA::AugeasParser.new("puppet.lns"), path, file_handler: file_handler)
end

Instance Method Details

#web_serviceAugeasTree

Returns the augeas tree for the “WebService” section

If the given section does not exist, it returns an empty one

Parameters:

  • name (String)

    section name

Returns:

  • (AugeasTree)


53
54
55
# File 'lib/dinstaller/cockpit_manager.rb', line 53

def web_service
  data["WebService"] ||= CFA::AugeasTree.new
end