mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Add logging to zonefile generating
This commit is contained in:
parent
3bb3bc3aa9
commit
e67217bbb0
1 changed files with 6 additions and 1 deletions
|
@ -9,12 +9,17 @@ class ZonefileSetting < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_zonefile(origin)
|
def self.generate_zonefile(origin)
|
||||||
|
filename = "#{origin}.zone"
|
||||||
|
|
||||||
|
logger.info("-----> Generating zonefile #{filename}")
|
||||||
|
|
||||||
zf = ActiveRecord::Base.connection.execute(
|
zf = ActiveRecord::Base.connection.execute(
|
||||||
"select generate_zonefile('#{origin}')"
|
"select generate_zonefile('#{origin}')"
|
||||||
)[0]['generate_zonefile']
|
)[0]['generate_zonefile']
|
||||||
|
|
||||||
filename = "#{origin}.zone"
|
|
||||||
File.open("#{APP_CONFIG['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
|
File.open("#{APP_CONFIG['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
|
||||||
|
|
||||||
|
logger.info("-----> Successfully generated zonefile #{filename}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue