Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

not overriding already set keys while create #16

Merged
merged 1 commit into from Jan 20, 2012
Jump to file or symbol
Failed to load files and symbols.
+8 −4
Split
@@ -215,10 +215,14 @@ def create_resource(resource)
key = prop if prop.serial?
end
resource_dup = resource.dup
- id = ldap.retrieve_next_id(resource.model.treebase,
- key_properties(resource).field)
- resource_dup.send("#{key_properties(resource).name}=".to_sym, id)
- props[key_properties(resource).field.to_sym] = "#{id}"
+
+ if props[key_properties(resource).field.to_sym].nil? then
+ id = ldap.retrieve_next_id(resource.model.treebase,
+ key_properties(resource).field)
+ resource_dup.send("#{key_properties(resource).name}=".to_sym, id)
+ props[key_properties(resource).field.to_sym] = "#{id}"
+ end
+
key_value = begin
ldap.create_object(resource.model.dn_prefix(resource_dup),
resource.model.treebase,