Created
January 24, 2012 00:39
-
-
Save pbruna/1666963 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'treequel' | |
require 'treequel/model' | |
require 'treequel/model/objectclass' | |
#Treequel.log.level=Logger::DEBUG | |
Treequel::Model.directory = Treequel.directory( | |
:host => "10.211.55.5", | |
:base_dn => "o=cruzverde,c=cl", | |
:bind_dn => "cn=admin,o=cruzverde,c=cl", | |
:pass => "suse.10", | |
:connect_type => :plain | |
) | |
module ScLocation | |
extend Treequel::Model::ObjectClass | |
model_class Treequel::Model | |
model_bases "o=cruzverde,c=cl" | |
model_objectclasses :scLocation | |
end | |
module OrganizationalUnit | |
extend Treequel::Model::ObjectClass | |
model_class Treequel::Model | |
model_bases "o=cruzverde,c=cl" | |
model_objectclasses :organizationalUnit | |
def self.find(id) | |
attrs, base = id.split(/,/,2) | |
name = attrs.split(/\=/) | |
query = {name[0].to_sym => name[1]} | |
filter(query).from(base).first | |
end | |
end | |
@sc_location = ScLocation.create("cn=stgo,ou=ferias,o=cruzverde,c=cl") | |
# Does Works | |
@sc_location.modify("ipNetworkNumber" => "192.168.0.0"); | |
# Does Work not works | |
@sc_location.ipNetworkNumber = "192.168.0.9" | |
@sc_location.save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment