You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2023/02/17 00:25:47 UTC
[nifi] branch main updated: NIFI-11193 Improve GitFlowPersisenceProvider logging
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new e7af4c10df NIFI-11193 Improve GitFlowPersisenceProvider logging
e7af4c10df is described below
commit e7af4c10dfa47e0f9872cd2534e2d52d963c7cf7
Author: Kevin Doran <kd...@apache.org>
AuthorDate: Thu Feb 16 15:28:59 2023 -0500
NIFI-11193 Improve GitFlowPersisenceProvider logging
This closes #6967
Co-authored-by: David Handermann <ex...@apache.org>
Signed-off-by: David Handermann <ex...@apache.org>
---
.../nifi/registry/provider/flow/git/GitFlowMetaData.java | 12 ++++--------
.../provider/flow/git/GitFlowPersistenceProvider.java | 3 +++
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java
index 4bac3284b3..0ef7d333a0 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java
@@ -181,16 +181,12 @@ class GitFlowMetaData {
* @param remoteRepository the URI value of the 'Remote Clone Repository' configuration
* @throws IOException if creating the repository fails
*/
- public void remoteRepoExists(String remoteRepository) throws IOException {
+ public void remoteRepoExists(String remoteRepository) throws GitAPIException, IOException {
final Git git = new Git(FileRepositoryBuilder.create(new File(remoteRepository)));
final LsRemoteCommand lsCmd = git.lsRemote();
- try {
- lsCmd.setRemote(remoteRepository);
- lsCmd.setCredentialsProvider(this.credentialsProvider);
- lsCmd.call();
- } catch (Exception e){
- throw new IllegalArgumentException("InvalidRemoteRepository : Given remote repository is not valid");
- }
+ lsCmd.setRemote(remoteRepository);
+ lsCmd.setCredentialsProvider(this.credentialsProvider);
+ lsCmd.call();
}
/**
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowPersistenceProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowPersistenceProvider.java
index d511f877b5..2d262dfa5f 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowPersistenceProvider.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowPersistenceProvider.java
@@ -94,9 +94,12 @@ public class GitFlowPersistenceProvider implements MetadataAwareFlowPersistenceP
flowStorageDir = new File(flowStorageDirValue);
final boolean localRepoExists = flowMetaData.localRepoExists(flowStorageDir);
if (remoteRepo != null && !remoteRepo.isEmpty() && !localRepoExists){
+ logger.info("Validating remote repository [{}]", remoteRepo);
flowMetaData.remoteRepoExists(remoteRepo);
+ logger.info("Cloning remote repository [{}] to [{}]", remoteRepo, flowStorageDirValue);
flowMetaData.cloneRepository(flowStorageDir, remoteRepo);
}
+ logger.info("Loading remote repository [{}]", remoteRepo);
flowMetaData.loadGitRepository(flowStorageDir);
flowMetaData.startPushThread();
logger.info("Configured GitFlowPersistenceProvider with Flow Storage Directory {}",