Project

General

Profile

« Previous | Next » 

Revision 127edd07

Added by Marc Dequènes almost 15 years ago

  • ID 127edd0742f83f34f7a2c94722ff6fb9836ef0da

[fix] catch more LDAP problems

View differences:

bin/shadowwalker
end
end
config.recursive_symbolize_keys!
ActiveLdap::Base.setup_connection(config[:ldap])
$program_options = {}
......
config[:aspects].each_pair do |aspect_name, aspect_data|
ldapctl.set_aspect(aspect_name, aspect_data)
end
config[:objects].each_pair do |obj_name, obj_data|
ldapctl.load_object(obj_name, obj_data)
begin
ActiveLdap::Base.setup_connection(config[:ldap])
config[:objects].each_pair do |obj_name, obj_data|
ldapctl.load_object(obj_name, obj_data)
end
ldapctl.load_relations
rescue ActiveLdap::Error => e
STDERR.puts "LDAP connection error: " + e.to_s
exit 3
end
ldapctl.load_relations
cmd = CmdParse::Command.new('list', false)
cmd.short_desc = "list objects"
......
end
if modification_done
puts "Modified attributes:"
begin
item.save!
rescue ActiveLdap::OperationNotPermitted => e
STDERR.puts "You don't have enough rights to modify--at least--one of these attributes."
exit 3
rescue ActiveLdap::LdapError => e
STDERR.puts "LDAP error: " + e.to_s
exit 3
rescue ActiveLdap::EntryInvalid => e
STDERR.puts e.to_s
exit 3
end
puts "Modification done."
......
end
cmdparser.add_command(cmd)
cmdparser.parse
begin
cmdparser.parse
rescue ActiveLdap::EntryInvalid => e
STDERR.puts e.to_s
exit 3
rescue ActiveLdap::OperationNotPermitted => e
STDERR.puts "You don't have enough rights for this operation."
exit 3
rescue ActiveLdap::Error => e
STDERR.puts "LDAP error: " + e.to_s
exit 3
end

Also available in: Unified diff