Module: OsCtld::DistConfig
- Extended by:
- OsCtl::Lib::Utils::Exception
- Defined in:
- lib/osctld/dist_config.rb
Defined Under Namespace
Modules: Distributions, Helpers, Network
Classes: Configurator
Class Method Summary
collapse
Class Method Details
.for(distribution) ⇒ Object
17
18
19
|
# File 'lib/osctld/dist_config.rb', line 17
def self.for(distribution)
@dists[distribution]
end
|
.register(distribution, klass) ⇒ Object
12
13
14
15
|
# File 'lib/osctld/dist_config.rb', line 12
def self.register(distribution, klass)
@dists ||= {}
@dists[distribution] = klass
end
|
.run(ctrc, cmd, **opts) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/osctld/dist_config.rb', line 24
def self.run(ctrc, cmd, **opts)
klass = self.for(ctrc.distribution.to_sym)
ctrc.mount if cmd != :stop
d = (klass || self.for(:other)).new(ctrc)
begin
d.method(cmd).call(opts)
rescue StandardError => e
ctrc.log(:warn, "DistConfig.#{cmd} failed: #{e.message}")
ctrc.log(:warn, denixstorify(e.backtrace).join("\n"))
if %i[dns_resolvers unset_dns_resolvers].include?(cmd)
raise CommandFailed, 'Unable to apply DNS resolver configuration; see osctld log'
end
end
end
|