From 268c421897750f4571cdf4afe20fa6b46732411d Mon Sep 17 00:00:00 2001 From: az Date: Mon, 6 Dec 2021 15:11:00 +0100 Subject: [PATCH] [skip ci] cleanup --- .../provs/core/cli/TargetCliCommand.kt | 11 ----------- .../provs/core/cli/TargetParser.kt | 10 ---------- .../extensions/server_software/k3s/application/Cli.kt | 1 + .../k3s/application/CliK3sArgumentsParser.kt | 2 +- .../server_software/k3s/application/CliK3sCommand.kt | 3 +-- 5 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetCliCommand.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetCliCommand.kt index 585bc5d..c4947af 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetCliCommand.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetCliCommand.kt @@ -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?, diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetParser.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetParser.kt index 5a22400..8314682 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetParser.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/TargetParser.kt @@ -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( diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/Cli.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/Cli.kt index 25e7f42..0c4eeb1 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/Cli.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/Cli.kt @@ -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 */ diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sArgumentsParser.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sArgumentsParser.kt index 89f6d5b..b405b73 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sArgumentsParser.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sArgumentsParser.kt @@ -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 } diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sCommand.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sCommand.kt index 61764f9..76eee68 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sCommand.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/k3s/application/CliK3sCommand.kt @@ -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(