From 9b6e1b33896a4fd5cfcfb42f3223e3e1b346f8b7 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 18 Oct 2006 12:22:51 +0000 Subject: Add squat's ldap2analog.rb git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@192 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- bin/ldap2analog.rb | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100755 bin/ldap2analog.rb diff --git a/bin/ldap2analog.rb b/bin/ldap2analog.rb new file mode 100755 index 0000000..5335360 --- /dev/null +++ b/bin/ldap2analog.rb @@ -0,0 +1,207 @@ +#!/usr/bin/ruby + +# +# Copyright (c) 2004,2005 Florian Reitmeir +# based on a script from Peter Palfrader +# +# All rights reserved. +# +# MIT license. +# + +require "ldap" +require "getoptlong" +require "myldap" +require "yaml" +require "fileutils" +require "optparse" + +# defaults +$force_rebuild = false + +def show_help(parser, code=0, io=STDOUT) + io.puts parser + exit(code) +end +ARGV.options do |opts| + opts.on_tail("-h", "--help", "Display this help screen") { show_help(opts) } + opts.on("-f", "--force" , String, "Force rebuilding the cachefiles") { $force_rebuild = true } + opts.parse! +end + +@config = YAML::load( File.open( '/etc/noreply/config' ) ) +ldap = MyLDAP.new(@config, "ldap2apache") +clients = ldap.conn.search2(@config['basedn'], LDAP::LDAP_SCOPE_SUBTREE, 'objectclass=tnClient') +@config_dir = @config['module']['analog']['config'] +@analog_dns = @config['module']['analog']['dns'] +@analog_caches = @config['module']['analog']['caches'] +@analog_output = @config['module']['analog']['output'] +@rmagic_dest = @config['module']['analog']['rmagic'] + +@analog_common = <