Class: Messhy::DnsManager

Inherits:
Object
  • Object
show all
Defined in:
lib/messhy/dns_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, ssh_executor: SSHExecutor.new(config), dry_run: false, skip: nil) ⇒ DnsManager

Returns a new instance of DnsManager.



9
10
11
12
13
14
# File 'lib/messhy/dns_manager.rb', line 9

def initialize(config, ssh_executor: SSHExecutor.new(config), dry_run: false, skip: nil)
  @config = config
  @ssh_executor = ssh_executor
  @dry_run = dry_run
  @skip = skip
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/messhy/dns_manager.rb', line 7

def config
  @config
end

#dry_runObject (readonly)

Returns the value of attribute dry_run.



7
8
9
# File 'lib/messhy/dns_manager.rb', line 7

def dry_run
  @dry_run
end

#ssh_executorObject (readonly)

Returns the value of attribute ssh_executor.



7
8
9
# File 'lib/messhy/dns_manager.rb', line 7

def ssh_executor
  @ssh_executor
end

Instance Method Details

#setupObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/messhy/dns_manager.rb', line 16

def setup
  return unless config.dns_enabled?

  case config.dns_provider
  when 'dnsmasq'
    setup_dnsmasq
  else
    raise Error, "Unsupported DNS provider: #{config.dns_provider}"
  end
end