[skip ci] cleanup
This commit is contained in:
parent
9dd8f55de8
commit
268c421897
5 changed files with 3 additions and 24 deletions
|
@ -1,16 +1,5 @@
|
||||||
package org.domaindrivenarchitecture.provs.core.cli
|
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(
|
class TargetCliCommand(
|
||||||
val localHost: Boolean?,
|
val localHost: Boolean?,
|
||||||
|
|
|
@ -3,16 +3,6 @@ package org.domaindrivenarchitecture.provs.core.cli
|
||||||
import kotlinx.cli.ArgParser
|
import kotlinx.cli.ArgParser
|
||||||
import kotlinx.cli.ArgType
|
import kotlinx.cli.ArgType
|
||||||
import kotlinx.cli.default
|
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) {
|
open class TargetParser(name: String) : ArgParser(name) {
|
||||||
val remoteHost by option(
|
val remoteHost by option(
|
||||||
|
|
|
@ -7,6 +7,7 @@ import kotlin.system.exitProcess
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provisions a k3s server, either locally or on a remote machine depending on the given arguments.
|
* 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
|
* Get help with option -h
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.domaindrivenarchitecture.provs.core.cli.TargetParser
|
||||||
|
|
||||||
class CliK3sArgumentsParser(name: String) : TargetParser(name) {
|
class CliK3sArgumentsParser(name: String) : TargetParser(name) {
|
||||||
|
|
||||||
enum class K3sType() {
|
enum class K3sType {
|
||||||
K3S, K3D
|
K3S, K3D
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,10 @@ class ServerCliCommand(private val k3sType: String, val target: TargetCliCommand
|
||||||
fun isValid(): Boolean {
|
fun isValid(): Boolean {
|
||||||
return target.isValid() && hasValidK3sType()
|
return target.isValid() && hasValidK3sType()
|
||||||
}
|
}
|
||||||
fun hasValidK3sType(): Boolean {
|
private fun hasValidK3sType(): Boolean {
|
||||||
return CliK3sArgumentsParser.K3sType.values().map { it.name }.contains(k3sType.uppercase())
|
return CliK3sArgumentsParser.K3sType.values().map { it.name }.contains(k3sType.uppercase())
|
||||||
}
|
}
|
||||||
fun type() = CliK3sArgumentsParser.K3sType.valueOf(k3sType.uppercase())
|
fun type() = CliK3sArgumentsParser.K3sType.valueOf(k3sType.uppercase())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseServerArguments(
|
fun parseServerArguments(
|
||||||
|
|
Loading…
Reference in a new issue