Project

General

Profile

« Previous | Next » 

Revision e04ae9bc

Added by Marc Dequènes almost 15 years ago

  • ID e04ae9bcb42fea89f17e0de9f58efc6c8a737346

[evol] 'create' action now ask for a location (which icurrently s a parent object)

View differences:

bin/shadowwalker
self.short_desc = "Create an item"
self.usages_params = [
"<object> <new_item> [<field>=<value>] ..."
"<object> <new_item> <location> [<field>=<value>] ..."
]
end
......
STDERR.puts "syntax error: no item name given"
exit 1
end
if args.size < 3
STDERR.puts "syntax error: no location name given"
exit 1
end
obj_hdl = args.shift
obj_klass = $ldapctl.find_klass(obj_hdl)
......
end
item_hdl = args.shift
location = args.shift
if location =~ /^([a-zA-Z]+)\/(.+)$/
loc_obj_hdl = $1
loc_item_hdl = $2
else
STDERR.puts "syntax error: bad location"
exit 1
end
loc_obj_klass = $ldapctl.find_klass(loc_obj_hdl)
if loc_obj_klass.nil?
STDERR.puts "No such location object '#{loc_obj_hdl}'."
exit 2
end
begin
loc_item = loc_obj_klass.find(loc_item_hdl)
rescue ActiveLdap::EntryNotFound
STDERR.puts "No such item '#{loc_obj_hdl}/#{loc_item_hdl}'"
exit 2
end
item = obj_klass.new(item_hdl)
item.base = loc_item.dn_obj - obj_klass.base_obj
args.each do |param|
param =~ /^([a-zA-Z]+)=(.*)$/
......
begin
cmdparser.parse
rescue ActiveLdap::EntryInvalid => e
# work around #26758
# work around activeldap#26758
STDERR.puts e.to_s.sub(/invalid format: .*: required syntax:/, "invalid format. required syntax:")
exit 3
rescue ActiveLdap::OperationNotPermitted => e

Also available in: Unified diff