From 835d777c90929f46600f855df8365ea705d3d94d Mon Sep 17 00:00:00 2001 From: ansgarz Date: Wed, 15 Dec 2021 22:51:55 +0100 Subject: [PATCH] fix for: new ssh session is required after making user a sudoer without password --- .../org/domaindrivenarchitecture/provs/core/cli/CliUtils.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliUtils.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliUtils.kt index bdbde81..15917a0 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliUtils.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliUtils.kt @@ -69,6 +69,9 @@ private fun createProvInstanceRemote( password != null, { "User ${prov.whoami()} not able to sudo on remote machine without password and no password available for the user." }) prov.makeUserSudoerWithNoSudoPasswordRequired(password) + + // a new session is required after making the user a sudoer without password + return remote(host, remoteUser, password) } else { throw IllegalStateException("User ${prov.whoami()} not able to sudo on remote machine without password and option not set to enable user to sudo without password.") }