remove check if config file exists from ServerCliCommand

merge-requests/2/head
az 2 years ago
parent 8767716908
commit ed8e86e758

@ -1,11 +1,9 @@
package org.domaindrivenarchitecture.provs.server.application
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.k3s.K3sCliCommand
import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3s
import org.domaindrivenarchitecture.provs.server.infrastructure.genericFileExistenceCheck
import kotlin.system.exitProcess
@ -33,13 +31,6 @@ fun main(args: Array<String>) {
println("Remote or localhost not valid, please try -h for help.")
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)
prov.provisionK3s(cmd as K3sCliCommand)

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

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

Loading…
Cancel
Save