@@ -849,24 +849,26 @@ def bind_as(args = {})
849
849
# ldap.add(:dn => dn, :attributes => attr)
850
850
# end
851
851
def add ( args )
852
- if @open_connection
853
- @result = @open_connection . add ( args )
854
- else
855
- @result = 0
856
- begin
857
- conn = Connection . new \
858
- :host => @host ,
859
- :port => @port ,
860
- :encryption => @encryption ,
861
- :instrumentation_service => @instrumentation_service
862
- if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
863
- @result = conn . add ( args )
852
+ instrument "add.net_ldap" , args do |payload |
853
+ if @open_connection
854
+ @result = @open_connection . add ( args )
855
+ else
856
+ @result = 0
857
+ begin
858
+ conn = Connection . new \
859
+ :host => @host ,
860
+ :port => @port ,
861
+ :encryption => @encryption ,
862
+ :instrumentation_service => @instrumentation_service
863
+ if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
864
+ @result = conn . add ( args )
865
+ end
866
+ ensure
867
+ conn . close if conn
864
868
end
865
- ensure
866
- conn . close if conn
867
869
end
870
+ @result . success?
868
871
end
869
- @result . success?
870
872
end
871
873
872
874
# Modifies the attribute values of a particular entry on the LDAP
@@ -950,25 +952,27 @@ def add(args)
950
952
# simultaneously by the server. It bears repeating that this concurrency
951
953
# does _not_ imply transactional atomicity, which LDAP does not provide.
952
954
def modify ( args )
953
- if @open_connection
954
- @result = @open_connection . modify ( args )
955
- else
956
- @result = 0
957
- begin
958
- conn = Connection . new \
959
- :host => @host ,
960
- :port => @port ,
961
- :encryption => @encryption ,
962
- :instrumentation_service => @instrumentation_service
963
- if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
964
- @result = conn . modify ( args )
955
+ instrument "modify.net_ldap" , args do |payload |
956
+ if @open_connection
957
+ @result = @open_connection . modify ( args )
958
+ else
959
+ @result = 0
960
+ begin
961
+ conn = Connection . new \
962
+ :host => @host ,
963
+ :port => @port ,
964
+ :encryption => @encryption ,
965
+ :instrumentation_service => @instrumentation_service
966
+ if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
967
+ @result = conn . modify ( args )
968
+ end
969
+ ensure
970
+ conn . close if conn
965
971
end
966
- ensure
967
- conn . close if conn
968
972
end
969
- end
970
973
971
- @result . success?
974
+ @result . success?
975
+ end
972
976
end
973
977
974
978
# Add a value to an attribute. Takes the full DN of the entry to modify,
@@ -1025,24 +1029,26 @@ def delete_attribute(dn, attribute)
1025
1029
#
1026
1030
# _Documentation_ _stub_
1027
1031
def rename ( args )
1028
- if @open_connection
1029
- @result = @open_connection . rename ( args )
1030
- else
1031
- @result = 0
1032
- begin
1033
- conn = Connection . new \
1034
- :host => @host ,
1035
- :port => @port ,
1036
- :encryption => @encryption ,
1037
- :instrumentation_service => @instrumentation_service
1038
- if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
1039
- @result = conn . rename ( args )
1032
+ instrument "rename.net_ldap" , args do |payload |
1033
+ if @open_connection
1034
+ @result = @open_connection . rename ( args )
1035
+ else
1036
+ @result = 0
1037
+ begin
1038
+ conn = Connection . new \
1039
+ :host => @host ,
1040
+ :port => @port ,
1041
+ :encryption => @encryption ,
1042
+ :instrumentation_service => @instrumentation_service
1043
+ if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
1044
+ @result = conn . rename ( args )
1045
+ end
1046
+ ensure
1047
+ conn . close if conn
1040
1048
end
1041
- ensure
1042
- conn . close if conn
1043
1049
end
1050
+ @result . success?
1044
1051
end
1045
- @result . success?
1046
1052
end
1047
1053
alias_method :modify_rdn , :rename
1048
1054
@@ -1056,24 +1062,26 @@ def rename(args)
1056
1062
# dn = "[email protected] , ou=people, dc=example, dc=com"
1057
1063
# ldap.delete :dn => dn
1058
1064
def delete ( args )
1059
- if @open_connection
1060
- @result = @open_connection . delete ( args )
1061
- else
1062
- @result = 0
1063
- begin
1064
- conn = Connection . new \
1065
- :host => @host ,
1066
- :port => @port ,
1067
- :encryption => @encryption ,
1068
- :instrumentation_service => @instrumentation_service
1069
- if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
1070
- @result = conn . delete ( args )
1065
+ instrument "delete.net_ldap" , args do |payload |
1066
+ if @open_connection
1067
+ @result = @open_connection . delete ( args )
1068
+ else
1069
+ @result = 0
1070
+ begin
1071
+ conn = Connection . new \
1072
+ :host => @host ,
1073
+ :port => @port ,
1074
+ :encryption => @encryption ,
1075
+ :instrumentation_service => @instrumentation_service
1076
+ if ( @result = conn . bind ( args [ :auth ] || @auth ) ) . result_code == 0
1077
+ @result = conn . delete ( args )
1078
+ end
1079
+ ensure
1080
+ conn . close
1071
1081
end
1072
- ensure
1073
- conn . close
1074
1082
end
1083
+ @result . success?
1075
1084
end
1076
- @result . success?
1077
1085
end
1078
1086
1079
1087
# Delete an entry from the LDAP directory along with all subordinate entries.
0 commit comments