remove check if config file exists from ServerCliCommand

This commit is contained in:
az 2022-08-30 17:36:31 +02:00
parent 8767716908
commit ed8e86e758
3 changed files with 0 additions and 19 deletions

View file

@ -1,11 +1,9 @@
package org.domaindrivenarchitecture.provs.server.application package org.domaindrivenarchitecture.provs.server.application
import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance
import org.domaindrivenarchitecture.provs.server.domain.ServerCliCommand
import org.domaindrivenarchitecture.provs.server.domain.ServerType import org.domaindrivenarchitecture.provs.server.domain.ServerType
import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand
import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3s import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3s
import org.domaindrivenarchitecture.provs.server.infrastructure.genericFileExistenceCheck
import kotlin.system.exitProcess import kotlin.system.exitProcess
@ -33,13 +31,6 @@ fun main(args: Array<String>) {
println("Remote or localhost not valid, please try -h for help.") println("Remote or localhost not valid, please try -h for help.")
exitProcess(1) exitProcess(1)
} }
if (!cmd.isValidConfigFileName()) {
println("Config file not found. Please check if path is correct.")
exitProcess(1)
}
if (!cmd.isValidServerType()) {
throw RuntimeException("Unknown serverType. Currently only k3s is accepted.")
}
val prov = createProvInstance(cmd.target) val prov = createProvInstance(cmd.target)
prov.provisionK3s(cmd as K3sCliCommand) prov.provisionK3s(cmd as K3sCliCommand)

View file

@ -2,7 +2,6 @@ package org.domaindrivenarchitecture.provs.server.domain
import org.domaindrivenarchitecture.provs.configuration.domain.ConfigFileName import org.domaindrivenarchitecture.provs.configuration.domain.ConfigFileName
import org.domaindrivenarchitecture.provs.configuration.domain.TargetCliCommand import org.domaindrivenarchitecture.provs.configuration.domain.TargetCliCommand
import org.domaindrivenarchitecture.provs.server.infrastructure.genericFileExistenceCheck
enum class ServerType { enum class ServerType {
K3D, K3S K3D, K3S
@ -19,10 +18,4 @@ open class ServerCliCommand(
fun isValidTarget(): Boolean { fun isValidTarget(): Boolean {
return target.isValid() return target.isValid()
} }
fun isValidConfigFileName(): Boolean {
if (configFileName == null) {
return true
}
return genericFileExistenceCheck(configFileName.fileName)
}
} }

View file

@ -1,7 +1,6 @@
package org.domaindrivenarchitecture.provs.server.application package org.domaindrivenarchitecture.provs.server.application
import org.domaindrivenarchitecture.provs.configuration.domain.TargetCliCommand import org.domaindrivenarchitecture.provs.configuration.domain.TargetCliCommand
import org.domaindrivenarchitecture.provs.server.domain.ServerType
import org.domaindrivenarchitecture.provs.server.domain.k3s.ApplicationFileName import org.domaindrivenarchitecture.provs.server.domain.k3s.ApplicationFileName
import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand
import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertEquals
@ -21,7 +20,6 @@ internal class CliArgumentParserTest {
// then // then
assertTrue(result.isValidServerType()) assertTrue(result.isValidServerType())
assertTrue(result.isValidTarget()) assertTrue(result.isValidTarget())
assertTrue(result.isValidConfigFileName())
} }
@Test @Test
@ -35,7 +33,6 @@ internal class CliArgumentParserTest {
// then // then
assertTrue(result.isValidServerType()) assertTrue(result.isValidServerType())
assertTrue(result.isValidTarget()) assertTrue(result.isValidTarget())
assertTrue(result.isValidConfigFileName())
assertEquals(listOf("grafana"), result.submodules) assertEquals(listOf("grafana"), result.submodules)
assertEquals(TargetCliCommand("local"), result.target) assertEquals(TargetCliCommand("local"), result.target)
} }