Class: OsCtld::DistConfig::Distributions::Chimera

Inherits:
Debian
  • Object
show all
Defined in:
lib/osctld/dist_config/distributions/chimera.rb

Instance Attribute Summary

Attributes inherited from Base

#configurator, #ct, #ctrc, #distribution, #version

Instance Method Summary collapse

Methods inherited from Base

#add_netif, #bin_path, #configurator_class, distribution, #dns_resolvers, #initialize, #log_type, #network, #post_mount, #pre_start, #remove_netif, #rename_netif, #set_hostname, #start, #stop, #unset_etc_hosts, #update_etc_hosts, #volatile_is_systemd?, #with_rootfs

Methods included from Utils::SwitchUser

#ct_attach, #ct_syscmd

Constructor Details

This class inherits a constructor from OsCtld::DistConfig::Distributions::Base

Instance Method Details

#apply_hostnameObject



7
8
9
10
11
# File 'lib/osctld/dist_config/distributions/chimera.rb', line 7

def apply_hostname
  ct_syscmd(ct, ['hostname', ct.hostname.local])
rescue SystemCommandFailed => e
  log(:warn, ct, "Unable to apply hostname: #{e.message}")
end

#passwd(opts) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/osctld/dist_config/distributions/chimera.rb', line 13

def passwd(opts)
  # Without the -c switch, the password is not set (bug?)
  ret = ct_syscmd(
    ct,
    %w[chpasswd -c SHA512],
    stdin: "#{opts[:user]}:#{opts[:password]}\n",
    run: true,
    valid_rcs: :all
  )

  return true if ret.success?

  log(:warn, ct, "Unable to set password: #{ret.output}")
end