Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.fizzed</groupId>
<artifactId>maven-parent</artifactId>
<version>2.7.0</version>
<version>3.4.0</version>
</parent>

<scm>
Expand All @@ -26,6 +26,8 @@
<jackson.version>2.14.1</jackson.version>
<slf4j.version>1.7.21</slf4j.version>
<blaze.version>1.6.0</blaze.version>
<slf4j.version>2.0.17</slf4j.version>
<blaze.version>2.6.0</blaze.version>
<crux.version>1.0.48</crux.version>
</properties>

Expand Down Expand Up @@ -116,15 +118,15 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
<version>2.14.0</version>
</dependency>

<!-- for creating assembly -->

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
<version>1.28.0</version>
</dependency>

<!-- yaml config files -->
Expand All @@ -150,7 +152,7 @@
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.20.Final</version>
<version>6.2.5.Final</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -194,7 +196,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
<version>2.19.0</version>
</dependency>

<!-- testing (hamcrest BEFORE junit important) -->
Expand All @@ -220,7 +222,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<version>1.5.18</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
21 changes: 6 additions & 15 deletions stork-deploy/src/main/java/com/fizzed/stork/deploy/Targets.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,11 @@ static private InitType initType(SshSession ssh) {
String initTypeString
= sshExec(ssh)
.command("sh").args("-c",
"if $(/sbin/init --version | egrep -q 'upstart'); then echo upstart; " +
"elif $(systemctl | egrep -q '.mount'); then echo systemd; " +
"if \\$(/sbin/init --version 2>/dev/null | egrep -q upstart); then echo upstart; " +
"elif \\$(systemctl 2>/dev/null| egrep -q .mount); then echo systemd; " +
"elif [ -f /etc/init.d/cron ] || [ -f /etc/init.d/crond ]; then echo sysv; " +
"else echo unknown; fi")
.pipeOutput(Streamables.captureOutput())
.pipeError(Streamables.nullOutput())
.runResult()
.map(Actions::toCaptureOutput)
.runCaptureOutput(false)
.asString();

if (initTypeString == null) {
Expand All @@ -117,13 +114,10 @@ static private Map<String,String> which(SshSession ssh, List<String> commands) {
// doesn't matter if we find it or not
String whichString
= sshExec(ssh, "which", commands.toArray())
.pipeOutput(Streamables.captureOutput())
.pipeError(Streamables.nullOutput())
.exitValues(0, 1, 2)
.runResult()
.map(Actions::toCaptureOutput)
.runCaptureOutput(false)
.asString();

if (whichString == null) {
return Collections.emptyMap();
}
Expand All @@ -143,11 +137,8 @@ static private Map<String,String> which(SshSession ssh, List<String> commands) {
static private String uname(SshSession ssh) {
// doesn't matter if we find it or not
return sshExec(ssh, "uname", "-srm")
.pipeOutput(Streamables.captureOutput())
.pipeError(Streamables.nullOutput())
.exitValues(0)
.runResult()
.map(Actions::toCaptureOutput)
.runCaptureOutput(false)
.asString()
.trim();
}
Expand Down
20 changes: 6 additions & 14 deletions stork-deploy/src/main/java/com/fizzed/stork/deploy/UnixTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ public Integer getUserId(String user) {
try {
String userId
= sshExec(false, false, "id", "-u", user)
.pipeOutput(Streamables.captureOutput())
.pipeError(Streamables.nullOutput())
.runResult()
.map(Actions::toCaptureOutput)
.runCaptureOutput(false)
.asString()
.trim();
return Integer.valueOf(userId);
Expand All @@ -180,10 +177,7 @@ public Integer getGroupId(String group) {
try {
String groupId
= sshExec(false, false, "id", "-g", group)
.pipeOutput(Streamables.captureOutput())
.pipeError(Streamables.nullOutput())
.runResult()
.map(Actions::toCaptureOutput)
.runCaptureOutput(false)
.asString()
.trim();
return Integer.valueOf(groupId);
Expand Down Expand Up @@ -264,9 +258,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())
.runResult()
.map(Actions::toCaptureOutput)
.runCaptureOutput(false)
.asString();
}

Expand Down Expand Up @@ -307,7 +299,7 @@ private void installDaemonDefaults(Deployment install, Daemon daemon) {
String defaultsFile = "/etc/" + dir + "/" + daemon.getName();

String cmd
= "if [ -d /etc/" + dir + " ]; then "
= "'if [ -d /etc/" + dir + " ]; then "
+ " if [ ! -f " + defaultsFile + " ]; then "
+ " echo \"APP_HOME=\\\"" + install.getCurrentDir() + "\\\"\" > " + defaultsFile + "; "
+ " echo \"APP_USER=\\\"" + install.getUser().orElse("") + "\\\"\" >> " + defaultsFile + "; "
Expand All @@ -318,7 +310,7 @@ private void installDaemonDefaults(Deployment install, Daemon daemon) {
+ " fi "
+ "else "
+ " exit 10; "
+ "fi";
+ "fi'";

Integer exitValue
= sshExec(true, true, cmd)
Expand Down Expand Up @@ -388,4 +380,4 @@ private void installSystemdDaemon(Deployment install, Daemon daemon, boolean onB

installDaemonDefaults(install, daemon);
}
}
}
Loading