fix logic of syspec verifications for desktop types ide and office if onlyModules are null as well as are not
This commit is contained in:
parent
00a94342d8
commit
e689e1c8c4
2 changed files with 25 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
||||||
package org.domaindrivenarchitecture.provs.desktop.application
|
package org.domaindrivenarchitecture.provs.desktop.application
|
||||||
|
|
||||||
import kotlinx.serialization.SerializationException
|
import kotlinx.serialization.SerializationException
|
||||||
import org.domaindrivenarchitecture.provs.desktop.domain.provisionDesktopCmd
|
import org.domaindrivenarchitecture.provs.desktop.domain.provisionDesktopCommand
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance
|
import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance
|
||||||
import java.io.FileNotFoundException
|
import java.io.FileNotFoundException
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
@ -20,7 +20,7 @@ fun main(args: Array<String>) {
|
||||||
val prov = createProvInstance(cmd.target, remoteHostSetSudoWithoutPasswordRequired = true)
|
val prov = createProvInstance(cmd.target, remoteHostSetSudoWithoutPasswordRequired = true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
provisionDesktopCmd(prov, cmd)
|
provisionDesktopCommand(prov, cmd)
|
||||||
} catch (e: SerializationException) {
|
} catch (e: SerializationException) {
|
||||||
println(
|
println(
|
||||||
"Error: File \"${cmd.configFile?.fileName}\" has an invalid format and or invalid data.\n"
|
"Error: File \"${cmd.configFile?.fileName}\" has an invalid format and or invalid data.\n"
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.domaindrivenarchitecture.provs.desktop.domain
|
||||||
|
|
||||||
import org.domaindrivenarchitecture.provs.desktop.infrastructure.*
|
import org.domaindrivenarchitecture.provs.desktop.infrastructure.*
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.git.provisionGit
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.git.provisionGit
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptPurge
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptPurge
|
||||||
|
@ -13,12 +12,19 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.provisionKeys
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.currentUserCanSudo
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.currentUserCanSudo
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.whoami
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.whoami
|
||||||
|
|
||||||
internal fun provisionDesktopCmd(prov: Prov, cmd: DesktopCliCommand) {
|
internal fun provisionDesktopCommand(prov: Prov, cmd: DesktopCliCommand) {
|
||||||
|
|
||||||
// retrieve config
|
// retrieve config
|
||||||
val conf = if (cmd.configFile != null) getConfig(cmd.configFile.fileName) else DesktopConfig()
|
val conf = if (cmd.configFile != null) getConfig(cmd.configFile.fileName) else DesktopConfig()
|
||||||
|
|
||||||
prov.provisionDesktop(cmd.type, conf.ssh?.keyPair(), conf.gpg?.keyPair(), conf.gitUserName, conf.gitEmail, cmd.onlyModules)
|
prov.provisionDesktop(
|
||||||
|
cmd.type,
|
||||||
|
conf.ssh?.keyPair(),
|
||||||
|
conf.gpg?.keyPair(),
|
||||||
|
conf.gitUserName,
|
||||||
|
conf.gitEmail,
|
||||||
|
cmd.onlyModules
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,14 +49,19 @@ internal fun Prov.provisionDesktop(
|
||||||
|
|
||||||
if (desktopType == DesktopType.OFFICE) {
|
if (desktopType == DesktopType.OFFICE) {
|
||||||
provisionOfficeDesktop(onlyModules)
|
provisionOfficeDesktop(onlyModules)
|
||||||
|
if (onlyModules == null) {
|
||||||
verifyOfficeSetup()
|
verifyOfficeSetup()
|
||||||
}
|
}
|
||||||
if (desktopType == DesktopType.IDE) {
|
|
||||||
provisionOfficeDesktop(onlyModules)
|
|
||||||
provisionIdeDesktop(onlyModules)
|
|
||||||
verifyIdeSetup()
|
|
||||||
}
|
}
|
||||||
ProvResult(true)
|
if (desktopType == DesktopType.IDE) {
|
||||||
|
if (onlyModules == null) {
|
||||||
|
provisionOfficeDesktop()
|
||||||
|
provisionIdeDesktop()
|
||||||
|
verifyIdeSetup()
|
||||||
|
} else {
|
||||||
|
provisionIdeDesktop(onlyModules)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Prov.validatePrecondition() {
|
fun Prov.validatePrecondition() {
|
||||||
|
@ -59,7 +70,7 @@ fun Prov.validatePrecondition() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Prov.provisionIdeDesktop(onlyModules: List<String>?) {
|
fun Prov.provisionIdeDesktop(onlyModules: List<String>? = null) {
|
||||||
if (onlyModules == null) {
|
if (onlyModules == null) {
|
||||||
aptInstall(OPEN_VPM)
|
aptInstall(OPEN_VPM)
|
||||||
aptInstall(OPENCONNECT)
|
aptInstall(OPENCONNECT)
|
||||||
|
@ -83,7 +94,7 @@ fun Prov.provisionIdeDesktop(onlyModules: List<String>?) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused") // used in other projects
|
||||||
fun Prov.provisionMSDesktop(onlyModules: List<String>?) {
|
fun Prov.provisionMSDesktop(onlyModules: List<String>?) {
|
||||||
if (onlyModules == null) {
|
if (onlyModules == null) {
|
||||||
installMsTeams()
|
installMsTeams()
|
||||||
|
@ -92,7 +103,7 @@ fun Prov.provisionMSDesktop(onlyModules: List<String>?) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Prov.provisionOfficeDesktop(onlyModules: List<String>?) {
|
fun Prov.provisionOfficeDesktop(onlyModules: List<String>? = null) {
|
||||||
if (onlyModules == null) {
|
if (onlyModules == null) {
|
||||||
aptInstall(ZIP_UTILS)
|
aptInstall(ZIP_UTILS)
|
||||||
aptInstall(BROWSER)
|
aptInstall(BROWSER)
|
||||||
|
@ -102,6 +113,7 @@ fun Prov.provisionOfficeDesktop(onlyModules: List<String>?) {
|
||||||
installZimWiki()
|
installZimWiki()
|
||||||
installNextcloudClient()
|
installNextcloudClient()
|
||||||
|
|
||||||
|
// optional as installation of these tools often fail and they are not considered mandatory
|
||||||
optional {
|
optional {
|
||||||
aptInstall(DRAWING_TOOLS)
|
aptInstall(DRAWING_TOOLS)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue