@@ -14,7 +14,6 @@ class FileDeployer(
14
14
val file : String? , val host : String , val port : Int , val user : String? , val password : String? ,
15
15
val reload : Boolean , val force : Boolean , val name : String? , val runtimeName : String? , val awaitReload : Boolean
16
16
) {
17
-
18
17
fun deploy () {
19
18
println (" deploy(): " + this )
20
19
checkHostDns()
@@ -41,6 +40,9 @@ class FileDeployer(
41
40
println (" given $file existent: ${File (file).isFile} " )
42
41
val deploySuccess = cli.cmd(" deploy $force $name $runtimeName $file " ).isSuccess
43
42
println (" deploy success: $deploySuccess " )
43
+
44
+ enableDeploymentIfNecessary(name)
45
+
44
46
if (reload) {
45
47
try {
46
48
val reloadSuccess = cli.cmd(" reload" ).isSuccess
@@ -61,6 +63,23 @@ class FileDeployer(
61
63
62
64
}
63
65
66
+ private fun enableDeploymentIfNecessary (name : String ) {
67
+ println (" \n checking if deployment is enabled..." )
68
+ val deploymentEnabled =
69
+ blockingCmd(" deployment-info" , 2 , ChronoUnit .MINUTES ).response.get(" result" ).asList().map {
70
+ it.asProperty().name to it.getParam(" enabled" ).removePrefix(" enabled: " )
71
+ }.firstOrNull {
72
+ it.first == name.removePrefix(" --name=" )
73
+ }?.second?.toBoolean()
74
+
75
+ if (deploymentEnabled == false ) {
76
+ println (" not enabled! going to enable now!" )
77
+ blockingCmd(" deploy $name " , 2 , ChronoUnit .MINUTES ).response.also {
78
+ println (" enable response: $it \n " )
79
+ }
80
+ }
81
+ }
82
+
64
83
private fun connect (cli : CLI ) {
65
84
cli.connect(host, port, user, password?.toCharArray())
66
85
}
0 commit comments