Fix for issue #2594 (list-backends CLI should not return 0 when basedn has a wrong value)
When a provided valid DN id neither a based DN nor below a based DN, we return "1"
| | |
| | | // backend ID argument was present, then list the base DNs for that backend. |
| | | // If the base DN argument was present, then list the backend for that base |
| | | // DN. If no arguments were provided, then list all backends and base DNs. |
| | | boolean invalidDn = false; |
| | | if (baseDN.isPresent()) |
| | | { |
| | | // Create a map from the base DNs of the backends to the corresponding |
| | |
| | | message = INFO_LISTBACKENDS_NO_BACKEND_FOR_DN.get( |
| | | dn.toString()); |
| | | out.println(message); |
| | | invalidDn = true; |
| | | break; |
| | | } |
| | | else |
| | |
| | | |
| | | |
| | | // If we've gotten here, then everything completed successfully. |
| | | return 0; |
| | | return invalidDn ? 1 : 0 ; |
| | | } |
| | | |
| | | |
| | |
| | | "--baseDN", "ou=nonexistent" |
| | | }; |
| | | |
| | | assertEquals(ListBackends.listBackends(args, false, null, null), 0); |
| | | assertEquals(ListBackends.listBackends(args, false, null, null), 1); |
| | | } |
| | | |
| | | |