Class: Dyndnsd::Updater::CommandWithBindZone
- Inherits:
-
Object
- Object
- Dyndnsd::Updater::CommandWithBindZone
- Defined in:
- lib/dyndnsd/updater/command_with_bind_zone.rb
Instance Method Summary collapse
-
#initialize(domain, updater_params) ⇒ CommandWithBindZone
constructor
A new instance of CommandWithBindZone.
- #update(db) ⇒ void
Constructor Details
#initialize(domain, updater_params) ⇒ CommandWithBindZone
Returns a new instance of CommandWithBindZone.
8 9 10 11 12 |
# File 'lib/dyndnsd/updater/command_with_bind_zone.rb', line 8 def initialize(domain, updater_params) @zone_file = updater_params['zone_file'] @command = updater_params['command'] @generator = Generator::Bind.new(domain, updater_params) end |
Instance Method Details
#update(db) ⇒ void
This method returns an undefined value.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dyndnsd/updater/command_with_bind_zone.rb', line 16 def update(db) # do not regenerate zone file (assumed to be persistent) if DB did not change return if !db.changed? Helper.span('updater_update') do |span| span.set_attribute('dyndnsd.updater.name', self.class.name&.split('::')&.last || 'None') # write zone file in bind syntax File.write(@zone_file, @generator.generate(db)) # call user-defined command pid = fork do exec @command end # detach so children don't become zombies Process.detach(pid) if pid end end |