This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Conifgure named.options | |
template: src=named.options.j2 dest=/etc/named/named.options | |
notify: | |
- restart named-chroot | |
tags: | |
- named_options | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto lo | |
iface lo inet loopback | |
iface lo inet6 loopback | |
auto eno1 | |
iface eno1 inet manual | |
pre-up ip l s $IFACE mtu 9000 | |
auto eno1.850 | |
iface eno1.850 inet statis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
module B | |
class Manager | |
include Module A::B::Notification | |
at_exit do | |
if $ERROR_INFO | |
error = { | |
timnestamp: Time.now, | |
message: $ERROR_INFO.message, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thread_pool = Concurrent::FixedThreadPool.new(10, max_queue:50) | |
until job_list.empty? | |
job = job_list.shift | |
Concurrent::Promises.future(executor: thread_pool) { MyJob.run(job) }. | |
rescue{ |e| puts e }.result | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Foo | |
module Bar | |
LOG = Logger.new() | |
def self.run() | |
thread_pool = Concurrent::FixedThreadPool.new(10, max_queue:50) | |
until mirrors.empty? | |
mirror = mirror.shift | |
Concurrent::Future.execute(executor: thread_pool) { Sync.run() } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
at_exit do | |
puts 'sync at_exit' | |
if $ERROR_INFO | |
puts 'yeaah' | |
error = { | |
timestamp: Time.now, | |
message: $ERROR_INFO.message, | |
backtrace: $ERROR_INFO.backtrace, | |
} | |
LOG.error YAML.dump(error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Notification | |
def self.send_email(msg) | |
Pony.mail({ | |
:to => Rise::MirrorManager.configuration.admin_email, | |
:from => "MirrorManager@#{Socket.gethostname}", | |
:via => :smtp, | |
:via_options => { | |
:address => 'aspmx.l.google.com', | |
:port => 25, | |
:domain => Socket.gethostname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Foo | |
module Bar | |
LOG = Logging.app_logger | |
def self.run(intervals) | |
mirrors = retrieve_mirrors(intervals) | |
run_syncs(mirrors) | |
end | |
def self.run_syncs(mirrors) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mirror_db = Rise::MirrorManager.configuration.database | |
unless File.exist?(mirror_db) | |
SQLite3::Database.new(mirror_db) do |db| | |
db.execute %{ | |
CREATE TABLE IF NOT EXISTS mirrors( | |
mirror_id INTEGER NOT NULL PRIMARY KEY, | |
name TEXT NOT NULL UNIQUE | |
);} | |
db.execute %{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Foo | |
module Bar | |
module Database | |
DB = Foo::Bar.configuration.database | |
def update_result(name, status) | |
# do something | |
end | |
end | |
end |