diff --git a/.gitignore b/.gitignore index ab7c0b9..3d46733 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target .vagrant *.iml .buildx +.idea diff --git a/pom.xml b/pom.xml index 3e6f132..07a09bb 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ com.fizzed maven-parent - 2.7.0 + 3.4.0 @@ -25,7 +25,7 @@ 3.2.5 2.14.1 1.7.21 - 1.6.0 + 2.0.0 1.0.48 diff --git a/stork-deploy/src/main/java/com/fizzed/stork/deploy/UnixTarget.java b/stork-deploy/src/main/java/com/fizzed/stork/deploy/UnixTarget.java index 2bbd3fe..5505173 100644 --- a/stork-deploy/src/main/java/com/fizzed/stork/deploy/UnixTarget.java +++ b/stork-deploy/src/main/java/com/fizzed/stork/deploy/UnixTarget.java @@ -85,24 +85,36 @@ public Path realpath(Object path) { @Override public void chown(boolean sudo, boolean recursive, String owner, String target) { - String options = ""; + final List args = new ArrayList<>(); + args.add("chown"); + if (recursive) { - options = "-R"; + args.add("-R"); } - sshExec(sudo, false, "chown", options, owner, target).run(); + args.add(owner); + args.add(target); + + this.sshExec(sudo, false, args.toArray()) + .run(); log.info("Set owner to {} for {}", owner, target); } @Override public void chmod(boolean sudo, boolean recursive, String permissions, String target) { - String options = ""; + final List args = new ArrayList<>(); + args.add("chmod"); + if (recursive) { - options = "-R"; + args.add("-R"); } - sshExec(sudo, false, "chmod", options, permissions, target).run(); + args.add(permissions); + args.add(target); + + this.sshExec(sudo, false, args.toArray()) + .run(); log.info("Set perms to {} for {}", permissions, target); } @@ -159,7 +171,7 @@ public Integer getUserId(String user) { try { String userId = sshExec(false, false, "id", "-u", user) - .pipeOutput(Streamables.captureOutput()) + .pipeOutput(Streamables.captureOutput(false)) .pipeError(Streamables.nullOutput()) .runResult() .map(Actions::toCaptureOutput) @@ -180,7 +192,7 @@ public Integer getGroupId(String group) { try { String groupId = sshExec(false, false, "id", "-g", group) - .pipeOutput(Streamables.captureOutput()) + .pipeOutput(Streamables.captureOutput(false)) .pipeError(Streamables.nullOutput()) .runResult() .map(Actions::toCaptureOutput) @@ -264,7 +276,7 @@ public void startDaemon(Daemon daemon) throws DeployerException { // run a status command so user can see what's up String output = sshExec(true, false, "systemctl", "status", daemon.getName()) - .pipeOutput(Streamables.captureOutput()) + .pipeOutput(Streamables.captureOutput(false)) .runResult() .map(Actions::toCaptureOutput) .asString(); @@ -376,12 +388,7 @@ private void installSysvDaemon(Deployment install, Daemon daemon, boolean onBoot } private void installSystemdDaemon(Deployment install, Daemon daemon, boolean onBoot) { - - // upload modified file to target, then copy it over - - - String sourceServiceFile = install.getCurrentDir() + "/share/systemd/" + daemon.getName() + ".service"; String serviceFile = "/etc/systemd/system/" + daemon.getName() + ".service"; copyFiles(true, sourceServiceFile, serviceFile); diff --git a/stork-launcher/src/test/java/com/fizzed/stork/launcher/LauncherTest.java b/stork-launcher/src/test/java/com/fizzed/stork/launcher/LauncherTest.java index 332c508..ea76c92 100644 --- a/stork-launcher/src/test/java/com/fizzed/stork/launcher/LauncherTest.java +++ b/stork-launcher/src/test/java/com/fizzed/stork/launcher/LauncherTest.java @@ -187,8 +187,7 @@ public String execute(int exitValue, Path exe, Map environment, S exec.run(); } else { - SshExec exec - = SecureShells.sshExec(ssh) + SshExec exec = (SshExec)SecureShells.sshExec(ssh) .command(exe) .args((Object[]) args) .exitValue(exitValue)