Class: Assh::FileProvider

Inherits:
Provider show all
Defined in:
lib/providers/file_provider.rb

Constant Summary collapse

ROOT =
File.expand_path('~/.autossh')
INCLUDES_KEY =
"Includes"
HOST_KEY =
"Host"
HOSTS_KEY =
"Hosts"
GROUP_KEY =
"Group"
GROUPS_KEY =
"Groups"

Instance Method Summary collapse

Methods inherited from Provider

#add_host, load_configuration!, register_provider!, status, verbose!

Constructor Details

#initialize(configuration) ⇒ FileProvider

Returns a new instance of FileProvider.



16
17
18
# File 'lib/providers/file_provider.rb', line 16

def initialize(configuration)
  super(configuration)
end

Instance Method Details

#parse_config!(config) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/providers/file_provider.rb', line 20

def parse_config!(config)
	return unless config
	raise 'Unexpected config type' unless config.is_a? Hash

	groups = config.delete(GROUPS_KEY)

	if hosts = config.delete(HOSTS_KEY)
		groups << {GROUP_KEY => 'ungrouped', HOSTS_KEY => hosts}
	end
	
	groups.each { |g| parse_group!(config, g) }
end