You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/01/08 10:14:16 UTC
[GitHub] asfgit closed pull request #3247: NIFI-5935: Handle error in LDAP
sync background thread
asfgit closed pull request #3247: NIFI-5935: Handle error in LDAP sync background thread
URL: https://github.com/apache/nifi/pull/3247
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authorization/Group.java b/nifi-framework-api/src/main/java/org/apache/nifi/authorization/Group.java
index 7908e856e0..72e03c6802 100644
--- a/nifi-framework-api/src/main/java/org/apache/nifi/authorization/Group.java
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authorization/Group.java
@@ -89,7 +89,7 @@ public int hashCode() {
@Override
public String toString() {
- return String.format("identifier[%s], name[%s]", getIdentifier(), getName());
+ return String.format("identifier[%s], name[%s], users[%s]", getIdentifier(), getName(), String.join(", ", users));
}
diff --git a/nifi-nar-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java b/nifi-nar-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java
index 2282578180..9b5dada4a0 100644
--- a/nifi-nar-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java
+++ b/nifi-nar-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java
@@ -392,7 +392,16 @@ public void onConfigured(final AuthorizerConfigurationContext configurationConte
}
// schedule the background thread to load the users/groups
- ldapSync.scheduleWithFixedDelay(() -> load(context), syncInterval, syncInterval, TimeUnit.MILLISECONDS);
+ ldapSync.scheduleWithFixedDelay(() -> {
+ try {
+ load(context);
+ } catch (final Throwable t) {
+ logger.error("Failed to sync User/Groups from LDAP due to {}. Will try again in {} millis.", new Object[] {t.toString(), syncInterval});
+ if (logger.isDebugEnabled()) {
+ logger.error("", t);
+ }
+ }
+ }, syncInterval, syncInterval, TimeUnit.MILLISECONDS);
} catch (final AuthorizationAccessException e) {
throw new AuthorizerCreationException(e);
}
@@ -639,6 +648,16 @@ protected Group doMapFromContext(DirContextOperations ctx) {
});
}
+ if (logger.isDebugEnabled()) {
+ logger.debug("-------------------------------------");
+ logger.debug("Loaded the following users from LDAP:");
+ userList.forEach((user) -> logger.debug(" - " + user));
+ logger.debug("--------------------------------------");
+ logger.debug("Loaded the following groups from LDAP:");
+ groupList.forEach((group) -> logger.debug(" - " + group));
+ logger.debug("--------------------------------------");
+ }
+
// record the updated tenants
tenants.set(new TenantHolder(new HashSet<>(userList), new HashSet<>(groupList)));
} finally {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services