From 2e2daf173f625aeb2fc0ac62dfc5ce267dd51a1e Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Mon, 23 May 2011 11:00:56 +0200 Subject: [PATCH] fix crash for unknown pg member names --- lib/pg_ldap_sync/application.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pg_ldap_sync/application.rb b/lib/pg_ldap_sync/application.rb index ae84f67..ed11e48 100644 --- a/lib/pg_ldap_sync/application.rb +++ b/lib/pg_ldap_sync/application.rb @@ -213,11 +213,12 @@ class Application pg_by_m2m = pg_roles.inject([]){|a,r| next a unless r.member_names a + r.member_names.map{|name| - has_member = pg_by_name[name] - unless has_member + if has_member=pg_by_name[name] + [r.name, has_member.name] + else log.warn{"pg member with name #{name} is unknown"} + nil end - [r.name, has_member.name] }.compact }