[skip ci] replace deprecated method by checkPackage
This commit is contained in:
parent
e1cbe57dad
commit
ad6c761e7a
4 changed files with 8 additions and 8 deletions
src/main/kotlin/org/domaindrivenarchitecture/provs
desktop/infrastructure
server/infrastructure
syspec/infrastructure
|
@ -3,7 +3,7 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
|||
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackage
|
||||
|
||||
|
||||
fun Prov.installVSCode(vararg options: String) = task {
|
||||
|
@ -34,7 +34,7 @@ private fun Prov.installVSCodePrerequisites() = task {
|
|||
@Suppress("unused") // only required for installation of vscode via apt
|
||||
private fun Prov.installVSCodeWithApt() = task {
|
||||
val packageName = "code"
|
||||
if (!isPackageInstalled(packageName)) {
|
||||
if (!checkPackage(packageName)) {
|
||||
// see https://code.visualstudio.com/docs/setup/linux
|
||||
// alternatively install with snapd (but this cannot be tested within docker as snapd within docker is not working/supported)
|
||||
sh("""
|
||||
|
|
|
@ -4,11 +4,11 @@ import org.domaindrivenarchitecture.provs.framework.core.Prov
|
|||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstallFromPpa
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackage
|
||||
|
||||
|
||||
fun Prov.installZimWiki() = task {
|
||||
if (isPackageInstalled("zim")) {
|
||||
if (checkPackage("zim")) {
|
||||
ProvResult(true, out = "zim already installed.")
|
||||
} else {
|
||||
aptInstallFromPpa("jaap.karssenberg", "zim", "zim")
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.domaindrivenarchitecture.provs.framework.core.Prov
|
|||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkFile
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFileFromResource
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackage
|
||||
|
||||
val pathSshConfig = "/etc/ssh/ssh_config"
|
||||
val pathSshdConfig = "/etc/ssh/sshd_config"
|
||||
|
@ -25,7 +25,7 @@ fun Prov.isSshdHardeningConfigExisting(): Boolean {
|
|||
}
|
||||
|
||||
fun Prov.configureSsh() = task {
|
||||
if(isSshdConfigExisting() && isSshConfigExisting() && !isSshdHardeningConfigExisting() && isPackageInstalled(packageNameSshServer)) {
|
||||
if(isSshdConfigExisting() && isSshConfigExisting() && !isSshdHardeningConfigExisting() && checkPackage(packageNameSshServer)) {
|
||||
createFileFromResource(
|
||||
pathSshConfig,
|
||||
"ssh_config",
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.domaindrivenarchitecture.provs.framework.core.Prov
|
|||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkDir
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkFile
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackage
|
||||
import org.domaindrivenarchitecture.provs.syspec.domain.*
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
|
@ -72,7 +72,7 @@ fun Prov.verify(hostspec: HostSpec) {
|
|||
}
|
||||
|
||||
fun Prov.verify(pkg: PackageSpec) {
|
||||
val res = isPackageInstalled(pkg.name)
|
||||
val res = checkPackage(pkg.name)
|
||||
verify(res == pkg.installed, "Package [${pkg.name}] is ${res.falseToNot()}installed.")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue