summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-10-22 20:24:47 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2006-10-22 20:24:47 +0000
commit37dda6dba59b63c888791ca1821ce8729463f91d (patch)
tree4bcdc19d29c829b9338079655a4378c679d339f5
parentb29173600baf6dfaa1bf914ce6b3302b94ffdc0b (diff)
print something that probably works as an ldif, some of the time
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@228 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xbin/ldap.add.client4
-rwxr-xr-xbin/ldap.add.vhost4
-rw-r--r--site-ruby/myldap.rb16
3 files changed, 13 insertions, 11 deletions
diff --git a/bin/ldap.add.client b/bin/ldap.add.client
index 19dc53b..015783d 100755
--- a/bin/ldap.add.client
+++ b/bin/ldap.add.client
@@ -92,10 +92,6 @@ data['description'] = [description] if description
dn = "o=%s,ou=hosting,%s"%[client, config['basedn']]
-puts dn
-puts data.to_yaml
-puts
-
ldap.add(dn, data)
%w(mail vhosts ftp dns).each{ |ou|
diff --git a/bin/ldap.add.vhost b/bin/ldap.add.vhost
index f8972df..ab65ba2 100755
--- a/bin/ldap.add.vhost
+++ b/bin/ldap.add.vhost
@@ -56,8 +56,4 @@ data['description'] = [@description] if @description
dn = "tnWebVHostServerName=%s,ou=vhosts,o=%s,ou=hosting,%s"%[@vhostname, @clientname, config['basedn']]
-puts dn
-puts data.to_yaml
-puts
-
ldap.add(dn, data)
diff --git a/site-ruby/myldap.rb b/site-ruby/myldap.rb
index 115d772..7705029 100644
--- a/site-ruby/myldap.rb
+++ b/site-ruby/myldap.rb
@@ -11,17 +11,27 @@ class MyLDAP
if use
@binddn = config['credentials'][use]['binddn']
@bindpw = config['credentials'][use]['bindpw']
- else
+ elsif File.exists? File.expand_path('~/.noreply.ldap')
myconfig = YAML::load( File.open( File.expand_path('~/.noreply.ldap') ) )
@binddn = myconfig['binddn']
@bindpw = myconfig['bindpw']
end
- unless @conn.bind(@binddn, @bindpw)
- @conn.perror("bind")
+ if @binddn and @bindpw
+ unless @conn.bind(@binddn, @bindpw)
+ @conn.perror("bind")
+ end
end
end
def add(dn, data)
+ puts "dn: #{dn}"
+ data.each_pair{
+ |key, value|
+ value.each { |v|
+ puts "#{key}: #{v}"
+ }
+ }
+ puts
begin
entry = data.map{
|key, value|