[skip ci] cleanup

This commit is contained in:
az 2021-12-06 15:11:00 +01:00
parent 9dd8f55de8
commit 268c421897
5 changed files with 3 additions and 24 deletions

View file

@ -1,16 +1,5 @@
package org.domaindrivenarchitecture.provs.core.cli
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.core.local
import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.GopassSecretSource
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource
import org.domaindrivenarchitecture.provs.ubuntu.user.base.currentUserCanSudo
import org.domaindrivenarchitecture.provs.ubuntu.user.base.makeUserSudoerWithNoSudoPasswordRequired
import org.domaindrivenarchitecture.provs.ubuntu.user.base.whoami
import kotlin.system.exitProcess
class TargetCliCommand(
val localHost: Boolean?,

View file

@ -3,16 +3,6 @@ package org.domaindrivenarchitecture.provs.core.cli
import kotlinx.cli.ArgParser
import kotlinx.cli.ArgType
import kotlinx.cli.default
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.core.local
import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.GopassSecretSource
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource
import org.domaindrivenarchitecture.provs.ubuntu.user.base.currentUserCanSudo
import org.domaindrivenarchitecture.provs.ubuntu.user.base.makeUserSudoerWithNoSudoPasswordRequired
import org.domaindrivenarchitecture.provs.ubuntu.user.base.whoami
import kotlin.system.exitProcess
open class TargetParser(name: String) : ArgParser(name) {
val remoteHost by option(

View file

@ -7,6 +7,7 @@ import kotlin.system.exitProcess
/**
* Provisions a k3s server, either locally or on a remote machine depending on the given arguments.
* Depending on the cli parameter "type" it will install the k3s server as standalone or as a container.
*
* Get help with option -h
*/

View file

@ -6,7 +6,7 @@ import org.domaindrivenarchitecture.provs.core.cli.TargetParser
class CliK3sArgumentsParser(name: String) : TargetParser(name) {
enum class K3sType() {
enum class K3sType {
K3S, K3D
}

View file

@ -7,11 +7,10 @@ class ServerCliCommand(private val k3sType: String, val target: TargetCliCommand
fun isValid(): Boolean {
return target.isValid() && hasValidK3sType()
}
fun hasValidK3sType(): Boolean {
private fun hasValidK3sType(): Boolean {
return CliK3sArgumentsParser.K3sType.values().map { it.name }.contains(k3sType.uppercase())
}
fun type() = CliK3sArgumentsParser.K3sType.valueOf(k3sType.uppercase())
}
fun parseServerArguments(