Class: Invoker::Power::Distro::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/invoker/power/setup/distro/base.rb

Direct Known Subclasses

Arch, Debian, Opensuse, Redhat

Constant Summary collapse

SOCAT_SHELLSCRIPT =
"/usr/bin/invoker_forwarder.sh"
SOCAT_SYSTEMD =
"/etc/systemd/system/socat_invoker.service"
RESOLVER_DIR =
"/etc/dnsmasq.d"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tld) ⇒ Base

Returns a new instance of Base.



39
40
41
# File 'lib/invoker/power/setup/distro/base.rb', line 39

def initialize(tld)
  self.tld = tld
end

Instance Attribute Details

#tldObject

Returns the value of attribute tld.



8
9
10
# File 'lib/invoker/power/setup/distro/base.rb', line 8

def tld
  @tld
end

Class Method Details

.distro_installer(tld) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/invoker/power/setup/distro/base.rb', line 14

def self.distro_installer(tld)
  case Facter[:operatingsystem].value
  when "Ubuntu"
    require "invoker/power/setup/distro/ubuntu"
    Ubuntu.new(tld)
  when "Fedora"
    require "invoker/power/setup/distro/redhat"
    Redhat.new(tld)
  when "Archlinux"
    require "invoker/power/setup/distro/arch"
    Arch.new(tld)
  when "Debian"
    require "invoker/power/setup/distro/debian"
    Debian.new(tld)
  when "LinuxMint"
    require "invoker/power/setup/distro/mint"
    Mint.new(tld)
  when "OpenSuSE"
    require "invoker/power/setup/distro/opensuse"
    Opensuse.new(tld)
  else
    raise "Your selected distro is not supported by Invoker"
  end
end

Instance Method Details

#install_required_softwareObject

Install required software



44
45
46
# File 'lib/invoker/power/setup/distro/base.rb', line 44

def install_required_software
  raise "Unimplemented"
end

#resolver_fileObject



10
11
12
# File 'lib/invoker/power/setup/distro/base.rb', line 10

def resolver_file
  File.join(RESOLVER_DIR, "#{tld}-tld")
end

#restart_servicesObject



48
49
50
51
52
53
# File 'lib/invoker/power/setup/distro/base.rb', line 48

def restart_services
  system("systemctl enable socat_invoker.service")
  system("systemctl enable dnsmasq")
  system("systemctl start socat_invoker.service")
  system("systemctl restart dnsmasq")
end