v0.8.20 fix provisioning a workplace

This commit is contained in:
az 2021-11-24 23:07:06 +01:00
parent f2fcc5ab77
commit 9edaabff98
4 changed files with 11 additions and 12 deletions

View file

@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization'
group = 'org.domaindrivenarchitecture.provs' group = 'org.domaindrivenarchitecture.provs'
version = '0.8.19' version = '0.8.20'
repositories { repositories {
mavenCentral() mavenCentral()

View file

@ -2,7 +2,6 @@ package org.domaindrivenarchitecture.provs.extensions.workplace
import org.domaindrivenarchitecture.provs.core.* import org.domaindrivenarchitecture.provs.core.*
import org.domaindrivenarchitecture.provs.core.processors.RemoteProcessor import org.domaindrivenarchitecture.provs.core.processors.RemoteProcessor
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceConfig
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
import org.domaindrivenarchitecture.provs.extensions.workplace.base.* import org.domaindrivenarchitecture.provs.extensions.workplace.base.*
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
@ -17,6 +16,7 @@ import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecr
import org.domaindrivenarchitecture.provs.ubuntu.user.base.currentUserCanSudo import org.domaindrivenarchitecture.provs.ubuntu.user.base.currentUserCanSudo
import org.domaindrivenarchitecture.provs.ubuntu.user.base.makeUserSudoerWithNoSudoPasswordRequired import org.domaindrivenarchitecture.provs.ubuntu.user.base.makeUserSudoerWithNoSudoPasswordRequired
import org.domaindrivenarchitecture.provs.ubuntu.user.base.whoami import org.domaindrivenarchitecture.provs.ubuntu.user.base.whoami
import org.domaindrivenarchitecture.provs.workplace.infrastructure.installDevOps
import java.net.InetAddress import java.net.InetAddress
import kotlin.system.exitProcess import kotlin.system.exitProcess
@ -97,6 +97,8 @@ fun Prov.provisionWorkplace(
// IDEs // IDEs
cmd("sudo snap install intellij-idea-community --classic") cmd("sudo snap install intellij-idea-community --classic")
installVSC("python", "clojure") installVSC("python", "clojure")
installDevOps()
} }
ProvResult(true) // dummy ProvResult(true) // dummy

View file

@ -1,18 +1,15 @@
package org.domaindrivenarchitecture.provs.workplace.application package org.domaindrivenarchitecture.provs.workplace.application
import org.domaindrivenarchitecture.provs.core.Password
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.extensions.workplace.provisionWorkplace
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceConfig import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceConfig
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
import org.domaindrivenarchitecture.provs.workplace.infrastructure.installDevOps
/** /**
* Use case for provisioning repos * Use case for provisioning a workplace
*/ */
fun Prov.provision(conf: WorkplaceConfig) = def { fun Prov.provision(conf: WorkplaceConfig, password: Secret?) = def {
if (conf.type == WorkplaceType.IDE) { with (conf) {
installDevOps() provisionWorkplace(type, ssh?.keyPair(), gpg?.keyPair(), gitUserName, gitEmail, password)
} }
ProvResult(true)
} }

View file

@ -35,7 +35,7 @@ private fun provision(cliCommand: CliCommand) {
val password: Secret? = retrievePassword(cliCommand) val password: Secret? = retrievePassword(cliCommand)
val prov: Prov = createProvInstance(cliCommand, password) val prov: Prov = createProvInstance(cliCommand, password)
prov.provision(conf) prov.provision(conf, password)
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
println( println(
"Error: File\u001b[31m $filename \u001b[0m was not found.\n" + "Error: File\u001b[31m $filename \u001b[0m was not found.\n" +