Revision 3cdff641
Added by Marc Dequènes over 13 years ago
- ID 3cdff641250aa4c4ed92bcc471b80acf0f692ac2
lib/cyborghood-librarian/interface/0_base.rb | ||
---|---|---|
node 'Records' do
|
||
node ['persons', 'dns_domains'] do
|
||
node ['Persons', 'DnsDomains'] do
|
||
object_list = Proc.new{|obj_name| bot.services.records.send(node_name.underscore, obj_name) }
|
||
|
||
on_request do |request|
|
||
request.reply.results = bot.services.records.send(node_name)
|
||
request.reply.results = object_list.call
|
||
end
|
||
|
||
node object_list do
|
||
on_request do |request|
|
||
prepare_value = Proc.new do |v|
|
||
if v.is_a? Array
|
||
v.collect!{|v2| prepare_value.call(v2) }
|
||
elsif v.is_a? ActiveLdap::DistinguishedName
|
||
v.to_s
|
||
else
|
||
v
|
||
end
|
||
end
|
||
|
||
obj_attrs = object_list.call(node_name).attributes
|
||
obj_attrs.delete('objectClass')
|
||
obj_attrs.each do |k, v|
|
||
obj_attrs[k] = prepare_value.call(v)
|
||
end
|
||
|
||
request.reply.results = obj_attrs
|
||
end
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] Librarian API work §2