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
16
17
18
|
# File 'lib/osctld/dist_config.rb', line 16
def self.for(distribution)
@dists[distribution]
end
|
.register(distribution, klass) ⇒ Object
11
12
13
14
|
# File 'lib/osctld/dist_config.rb', line 11
def self.register(distribution, klass)
@dists ||= {}
@dists[distribution] = klass
end
|
.run(ctrc, cmd, **opts) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/osctld/dist_config.rb', line 23
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"))
end
end
|