This is an automated email from the ASF dual-hosted git repository.

kdoran pushed a commit to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/support/nifi-1.x by this push:
     new 17b4480831 NIFI-11193 Improve GitFlowPersisenceProvider logging
17b4480831 is described below

commit 17b4480831a9b0f194f5db74ba72c454242776cb
Author: Kevin Doran <kdo...@apache.org>
AuthorDate: Thu Feb 16 15:28:59 2023 -0500

    NIFI-11193 Improve GitFlowPersisenceProvider logging
    
    This closes #6967
    
    Co-authored-by: David Handermann <exceptionfact...@apache.org>
    Signed-off-by: David Handermann <exceptionfact...@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 {}",

Reply via email to