Class: Invoker::Power::Distro::Ubuntu

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

Constant Summary

Constants inherited from Base

Base::RESOLVER_DIR, Base::SOCAT_SHELLSCRIPT, Base::SOCAT_SYSTEMD

Instance Method Summary collapse

Methods inherited from Base

distro, distro_installer, #initialize, #restart_services

Constructor Details

This class inherits a constructor from Invoker::Power::Distro::Base

Instance Method Details

#get_user_confirmation?Boolean

Returns:

  • (Boolean)


37
38
39
40
41
42
# File 'lib/invoker/power/setup/distro/ubuntu.rb', line 37

def get_user_confirmation?
  if using_systemd_resolved? && tld != 'localhost'
    Invoker::Logger.puts("Ubuntu installations using systemd-resolved (typically Ubuntu 17+) only support the .localhost domain, so your tld setting (or the default) will be ignored.".colorize(:yellow))
  end
  super
end

#install_otherObject



25
26
27
# File 'lib/invoker/power/setup/distro/ubuntu.rb', line 25

def install_other
  using_systemd_resolved? ? nil : super
end

#install_packagesObject



21
22
23
# File 'lib/invoker/power/setup/distro/ubuntu.rb', line 21

def install_packages
  using_systemd_resolved? ? "socat" : super
end

#install_required_softwareObject



12
13
14
15
16
17
18
19
# File 'lib/invoker/power/setup/distro/ubuntu.rb', line 12

def install_required_software
  if using_systemd_resolved?
    # Don't install dnsmasq if Ubuntu version uses systemd-resolved for DNS because they conflict
    system("apt-get --assume-yes install socat")
  else
    super
  end
end

#resolver_fileObject



29
30
31
# File 'lib/invoker/power/setup/distro/ubuntu.rb', line 29

def resolver_file
  using_systemd_resolved? ? nil : super
end

#tldObject



33
34
35
# File 'lib/invoker/power/setup/distro/ubuntu.rb', line 33

def tld
  using_systemd_resolved? ? 'localhost' : @tld
end

#using_systemd_resolved?Boolean

Returns:

  • (Boolean)


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

def using_systemd_resolved?
  return @_using_systemd_resolved if defined?(@_using_systemd_resolved)
  @_using_systemd_resolved = system("systemctl is-active --quiet systemd-resolved")
end