|
|
@ -103,7 +103,7 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun cmdInContainer(containerName: String, vararg args: String): Array<String> {
|
|
|
|
private fun cmdInContainer(containerName: String, vararg args: String): Array<String> {
|
|
|
|
return arrayOf(SHELL, "-c", "sudo docker exec $containerName " + buildCommand(*args))
|
|
|
|
return arrayOf(SHELL, "-c", "sudo docker exec $containerName " + buildCommand(*args))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private fun buildCommand(vararg args: String) : String {
|
|
|
|
private fun buildCommand(vararg args: String) : String {
|
|
|
@ -247,11 +247,11 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|
|
|
} else if (mode == ResultMode.NONE) {
|
|
|
|
} else if (mode == ResultMode.NONE) {
|
|
|
|
ProvResult(true)
|
|
|
|
ProvResult(true)
|
|
|
|
} else if (mode == ResultMode.FAILEXIT) {
|
|
|
|
} else if (mode == ResultMode.FAILEXIT) {
|
|
|
|
if (res.success) {
|
|
|
|
return if (res.success) {
|
|
|
|
return ProvResult(true)
|
|
|
|
ProvResult(true)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
exit = true
|
|
|
|
exit = true
|
|
|
|
return ProvResult(false)
|
|
|
|
ProvResult(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ProvResult(false, err = "mode unknown")
|
|
|
|
ProvResult(false, err = "mode unknown")
|
|
|
@ -295,12 +295,12 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|
|
|
private data class InternalResult(val level: Int, val method: String?, var provResult: ProvResult?) {
|
|
|
|
private data class InternalResult(val level: Int, val method: String?, var provResult: ProvResult?) {
|
|
|
|
override fun toString() : String {
|
|
|
|
override fun toString() : String {
|
|
|
|
val provResult = provResult
|
|
|
|
val provResult = provResult
|
|
|
|
if (provResult != null) {
|
|
|
|
return if (provResult != null) {
|
|
|
|
return prefix(level) + (if (provResult.success) "Success -- " else "FAILED -- ") +
|
|
|
|
prefix(level) + (if (provResult.success) "Success -- " else "FAILED -- ") +
|
|
|
|
method + " " + (provResult.cmd ?: "") +
|
|
|
|
method + " " + (provResult.cmd ?: "") +
|
|
|
|
(if (!provResult.success && provResult.err != null) " -- Error: " + provResult.err.escapeNewline() else "") }
|
|
|
|
(if (!provResult.success && provResult.err != null) " -- Error: " + provResult.err.escapeNewline() else "")
|
|
|
|
else
|
|
|
|
} else
|
|
|
|
return prefix(level) + " " + method + " " + "... in progress ... "
|
|
|
|
prefix(level) + " " + method + " " + "... in progress ... "
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -309,9 +309,9 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val ANSI_RESET = "\u001B[0m"
|
|
|
|
private val ANSI_RESET = "\u001B[0m"
|
|
|
|
val ANSI_BRIGHT_RED = "\u001B[91m"
|
|
|
|
private val ANSI_BRIGHT_RED = "\u001B[91m"
|
|
|
|
val ANSI_BRIGHT_GREEN = "\u001B[92m"
|
|
|
|
private val ANSI_BRIGHT_GREEN = "\u001B[92m"
|
|
|
|
// uncomment if needed
|
|
|
|
// uncomment if needed
|
|
|
|
// val ANSI_BLACK = "\u001B[30m"
|
|
|
|
// val ANSI_BLACK = "\u001B[30m"
|
|
|
|
// val ANSI_RED = "\u001B[31m"
|
|
|
|
// val ANSI_RED = "\u001B[31m"
|
|
|
@ -336,7 +336,7 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|
|
|
if (internalResults.size > 1) {
|
|
|
|
if (internalResults.size > 1) {
|
|
|
|
println("----------------------------------------------------------------------------------------------------- ")
|
|
|
|
println("----------------------------------------------------------------------------------------------------- ")
|
|
|
|
println(
|
|
|
|
println(
|
|
|
|
"Overall " + internalResults.get(0).toString().take(10)
|
|
|
|
"Overall " + internalResults[0].toString().take(10)
|
|
|
|
.replace("Success", ANSI_BRIGHT_GREEN + "Success" + ANSI_RESET)
|
|
|
|
.replace("Success", ANSI_BRIGHT_GREEN + "Success" + ANSI_RESET)
|
|
|
|
.replace("FAILED", ANSI_BRIGHT_RED + "FAILED" + ANSI_RESET)
|
|
|
|
.replace("FAILED", ANSI_BRIGHT_RED + "FAILED" + ANSI_RESET)
|
|
|
|
)
|
|
|
|
)
|
|
|
|