[Da-tools-discuss] Configuring the host to pull data from
Mark Hymers
mhy at debian.org
Thu Dec 27 11:07:18 UTC 2007
On Thu, 27, Dec, 2007 at 09:36:30AM +0100, Marc 'HE' Brockschmidt spoke thus..
> I hate (iii), think (i) is hackish and am not happy about (ii), so
> perhaps someone else has an opinion?
What about extending (i) to be a fairly trivial ud-config python script
which allows us to query the config file from shell; something like:
ud-config ldaphost
ud-config basedn
Trivial version attached which I'll commit if people think it's sensible.
Mark
--
Mark Hymers <mhy at debian dot org>
"But Yossarian *still* didn't understand either how Milo could buy eggs
in Malta for seven cents apiece and sell them at a profit in Pianosa
for five cents."
Catch 22, Joseph Heller
-------------- next part --------------
#!/usr/bin/python
#
# Copyright (c) 2007 Mark Hymers <mhy at debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import sys
import imp
usage = '''Usage: ud-config VARIABLE
Prints config information from userdir-ldap.conf'''
if len(sys.argv) != 2:
print usage
sys.exit(1)
try:
File = open("/etc/userdir-ldap/userdir-ldap.conf");
except:
File = open("userdir-ldap.conf");
ConfModule = imp.load_source("userdir_config","/etc/userdir-ldap.conf",File);
File.close();
try:
res = getattr(ConfModule, sys.argv[1])
print res
except AttributeError:
sys.exit(1)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/da-tools-discuss/attachments/20071227/98cb6450/attachment.pgp
More information about the Da-tools-discuss
mailing list