diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt index bd85441..ff627a7 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/application/Application.kt @@ -19,10 +19,12 @@ fun main(args: Array) { } val prov = createProvInstance(cmd.target) - prov.ensureSudoWithoutPassword(cmd.target.remoteTarget()?.password) try { - provisionDesktopCommand(prov, cmd) + prov.task { + ensureSudoWithoutPassword(cmd.target.remoteTarget()?.password) + provisionDesktopCommand(cmd) + } } catch (e: SerializationException) { println( "Error: File \"${cmd.configFile?.fileName}\" has an invalid format and or invalid data.\n" diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt index 9a03b87..cbec35e 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt @@ -12,12 +12,12 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.provisionKeys import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.currentUserCanSudoWithoutPassword import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.whoami -internal fun provisionDesktopCommand(prov: Prov, cmd: DesktopCliCommand) { +internal fun Prov.provisionDesktopCommand(cmd: DesktopCliCommand) = task { // retrieve config val conf = if (cmd.configFile != null) getConfig(cmd.configFile.fileName) else DesktopConfig() - prov.provisionDesktop( + provisionDesktop( cmd.type, conf.ssh?.keyPair(), conf.gpg?.keyPair(),