Skip to content

Instantly share code, notes, and snippets.

@pbruna
Created January 24, 2012 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbruna/1666963 to your computer and use it in GitHub Desktop.
Save pbruna/1666963 to your computer and use it in GitHub Desktop.
#!/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