Skip to content

Commit ac8be09

Browse files
authored
chore: logs added forn the rsync
1 parent 86bf88a commit ac8be09

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/main/java/io/spaship/sidecar/services/RequestProcessor.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,11 @@ private OperationResponse handleFileOps(OperationResponse.OperationResponseBuild
134134
int status, Path sourcePath) {
135135
try {
136136
var source = sourcePath.toString();
137+
LOG.info("source : {}", source);
137138
var destination = destinationPath.toString();
139+
LOG.info("destination : {}", source);
138140
source = formatSourceDirName(source);
141+
LOG.info("formatSourceDirName : {}", source);
139142
rsync(source, destination);
140143
enforceHtAccessRule(destinationPath, spashipMeta.second);
141144
} catch (Exception e) {
@@ -164,10 +167,13 @@ private OperationResponse handleFileOps(OperationResponse.OperationResponseBuild
164167

165168
private void rsync(String source, String destination) throws IOException, InterruptedException {
166169
// do not use `-a` as it tries to preserve file ownership and permissions leading to permission issues
170+
LOG.info("rsync process started");
167171
ProcessBuilder processBuilder = new ProcessBuilder("rsync", "-rlS", "--delete", source, destination);
172+
LOG.info("ProcessBuilder initialized");
168173
Process process = processBuilder.start();
174+
LOG.info("Process started");
169175
int exitCode = process.waitFor();
170-
176+
LOG.info("Process completed with exit the code {}", exitCode);
171177
if (exitCode == 0) {
172178
LOG.info("Synchronization completed successfully.");
173179
} else {
@@ -278,16 +284,14 @@ private Tuple<String, SpashipMapping> extractSpashipMeta(String unZippedPath) {
278284
}
279285

280286

281-
private int prepareDeploymentDirectory(String dirName, String parentDirectory, String contextPath) {
287+
private int prepareDeploymentDirectory(String dirName, String parentDirectory, String contextPath) {
282288
var isNestedContextPath = contextPath.contains(File.separator);
283289
LOG.debug("nested context path detection status {}", isNestedContextPath);
284-
285290
// new status for identification of deployment in root directory
286291
if (dirName.equalsIgnoreCase(parentDirectory)) {
287292
LOG.debug("deploying spa in root directory");
288293
return -1;
289294
}
290-
291295
if (isSpaDirExists(dirName)) {
292296
return 1;
293297
}
@@ -309,7 +313,7 @@ private boolean isSpaDirExists(String dirName) {
309313
return exists;
310314
}
311315

312-
private void deleteDirectory(String dirName) {
316+
private void deleteDirectory(String dirName) {
313317
var dir = new File(dirName);
314318
var deleted = false;
315319
try {

0 commit comments

Comments
 (0)