Class: OsCtld::DistConfig::Distributions::RedHat::Configurator
- Inherits:
-
Configurator
- Object
- Configurator
- OsCtld::DistConfig::Distributions::RedHat::Configurator
- Includes:
- Helpers::RedHat
- Defined in:
- lib/osctld/dist_config/distributions/redhat.rb
Direct Known Subclasses
AlmaLinux::Configurator, CentOS::Configurator, Fedora::Configurator, OsCtld::DistConfig::Distributions::Rocky::Configurator
Instance Attribute Summary
Attributes inherited from Configurator
#ctid, #distribution, #network_backend, #rootfs, #version
Instance Method Summary collapse
Methods included from Helpers::RedHat
Methods inherited from Configurator
#add_netif, #dns_resolvers, #initialize, #instantiate_network_class, #log_type, #network, #network_class, #remove_netif, #rename_netif, #unset_etc_hosts, #update_etc_hosts
Methods included from Helpers::Common
#systemd_service_enabled?, #systemd_service_masked?, #writable?
Constructor Details
This class inherits a constructor from OsCtld::DistConfig::Configurator
Instance Method Details
#set_hostname(new_hostname, old_hostname: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/osctld/dist_config/distributions/redhat.rb', line 9 def set_hostname(new_hostname, old_hostname: nil) # /etc/hostname writable?(File.join(rootfs, 'etc', 'hostname')) do |path| regenerate_file(path, 0o644) do |f| f.puts(new_hostname.local) end end # /etc/sysconfig/network for older systems set_params( File.join(rootfs, 'etc', 'sysconfig', 'network'), { 'HOSTNAME' => new_hostname.local } ) end |