From d03b6ff4b7a665e8e5ec5c91fc00e33554b4b99c Mon Sep 17 00:00:00 2001 From: az Date: Thu, 13 Apr 2023 22:30:38 +0200 Subject: [PATCH] add ensureSudoWithoutPassword to provs-server --- .../provs/server/application/Application.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/Application.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/Application.kt index 1e37e33..adddee0 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/Application.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/Application.kt @@ -1,6 +1,8 @@ package org.domaindrivenarchitecture.provs.server.application +import org.domaindrivenarchitecture.provs.configuration.application.ensureSudoWithoutPassword import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance +import org.domaindrivenarchitecture.provs.framework.core.cli.quit import org.domaindrivenarchitecture.provs.server.domain.ServerType import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3sCommand @@ -25,14 +27,16 @@ fun main(args: Array) { val cmd = CliArgumentsParser("provs-server.jar subcommand target").parseCommand(checkedArgs) - // ToDo: exitProcess makes testing harder, find another solution // validate parsed arguments if (!cmd.isValidTarget()) { println("Remote or localhost not valid, please try -h for help.") - exitProcess(1) + quit(1) } val prov = createProvInstance(cmd.target) - prov.provisionK3sCommand(cmd as K3sCliCommand) + prov.session { + ensureSudoWithoutPassword(cmd.target.remoteTarget()?.password) + provisionK3sCommand(cmd as K3sCliCommand) + } }