mirror of
https://github.com/apache/nifi.git
synced 2025-02-08 02:58:43 +00:00
NIFI-11193 Improve GitFlowPersisenceProvider logging
This closes #6967 Co-authored-by: David Handermann <exceptionfactory@apache.org> Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
6f2b9e5f65
commit
17b4480831
@ -181,16 +181,12 @@ class GitFlowMetaData {
|
|||||||
* @param remoteRepository the URI value of the 'Remote Clone Repository' configuration
|
* @param remoteRepository the URI value of the 'Remote Clone Repository' configuration
|
||||||
* @throws IOException if creating the repository fails
|
* @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 Git git = new Git(FileRepositoryBuilder.create(new File(remoteRepository)));
|
||||||
final LsRemoteCommand lsCmd = git.lsRemote();
|
final LsRemoteCommand lsCmd = git.lsRemote();
|
||||||
try {
|
lsCmd.setRemote(remoteRepository);
|
||||||
lsCmd.setRemote(remoteRepository);
|
lsCmd.setCredentialsProvider(this.credentialsProvider);
|
||||||
lsCmd.setCredentialsProvider(this.credentialsProvider);
|
lsCmd.call();
|
||||||
lsCmd.call();
|
|
||||||
} catch (Exception e){
|
|
||||||
throw new IllegalArgumentException("InvalidRemoteRepository : Given remote repository is not valid");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,9 +94,12 @@ public class GitFlowPersistenceProvider implements MetadataAwareFlowPersistenceP
|
|||||||
flowStorageDir = new File(flowStorageDirValue);
|
flowStorageDir = new File(flowStorageDirValue);
|
||||||
final boolean localRepoExists = flowMetaData.localRepoExists(flowStorageDir);
|
final boolean localRepoExists = flowMetaData.localRepoExists(flowStorageDir);
|
||||||
if (remoteRepo != null && !remoteRepo.isEmpty() && !localRepoExists){
|
if (remoteRepo != null && !remoteRepo.isEmpty() && !localRepoExists){
|
||||||
|
logger.info("Validating remote repository [{}]", remoteRepo);
|
||||||
flowMetaData.remoteRepoExists(remoteRepo);
|
flowMetaData.remoteRepoExists(remoteRepo);
|
||||||
|
logger.info("Cloning remote repository [{}] to [{}]", remoteRepo, flowStorageDirValue);
|
||||||
flowMetaData.cloneRepository(flowStorageDir, remoteRepo);
|
flowMetaData.cloneRepository(flowStorageDir, remoteRepo);
|
||||||
}
|
}
|
||||||
|
logger.info("Loading remote repository [{}]", remoteRepo);
|
||||||
flowMetaData.loadGitRepository(flowStorageDir);
|
flowMetaData.loadGitRepository(flowStorageDir);
|
||||||
flowMetaData.startPushThread();
|
flowMetaData.startPushThread();
|
||||||
logger.info("Configured GitFlowPersistenceProvider with Flow Storage Directory {}",
|
logger.info("Configured GitFlowPersistenceProvider with Flow Storage Directory {}",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user