mob
This commit is contained in:
parent
d9d8678b82
commit
1ad357ba44
4 changed files with 25 additions and 7 deletions
|
@ -0,0 +1,5 @@
|
||||||
|
package org.domaindrivenarchitecture.provs.server.domain.k3s
|
||||||
|
|
||||||
|
interface ApplicationFileRepository {
|
||||||
|
fun exists(applicationFileName: ApplicationFileName?): Boolean
|
||||||
|
}
|
|
@ -18,10 +18,5 @@ class K3sCliCommand(
|
||||||
target,
|
target,
|
||||||
configFileName
|
configFileName
|
||||||
) {
|
) {
|
||||||
fun isValidApplicationFileName(): Boolean {
|
|
||||||
if (applicationFileName == null) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return genericFileExistenceCheck(applicationFileName.fileName)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -14,7 +14,10 @@ fun Prov.provisionK3s(cli: K3sCliCommand) = task {
|
||||||
if (cli.submodules == null && !cli.reprovision) {
|
if (cli.submodules == null && !cli.reprovision) {
|
||||||
// full k3s
|
// full k3s
|
||||||
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
|
||||||
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
||||||
|
if(repo.exists(cli.applicationFileName)) {
|
||||||
|
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (cli.reprovision) { // TODO: Add logic that overrides config, when cmd option is set
|
else if (cli.reprovision) { // TODO: Add logic that overrides config, when cmd option is set
|
||||||
deprovisionK3sInfra()
|
deprovisionK3sInfra()
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.domaindrivenarchitecture.provs.server.infrastructure
|
||||||
|
|
||||||
|
import org.domaindrivenarchitecture.provs.server.domain.k3s.ApplicationFileName
|
||||||
|
import org.domaindrivenarchitecture.provs.server.domain.k3s.ApplicationFileRepository
|
||||||
|
|
||||||
|
class DefaultApplicationFileRepository : ApplicationFileRepository {
|
||||||
|
|
||||||
|
override fun exists(applicationFileName: ApplicationFileName?): Boolean {
|
||||||
|
if (applicationFileName == null) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return genericFileExistenceCheck(applicationFileName.fileName)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue