From ad6c761e7a16cd727dfa52792f47a44ff0f7151c Mon Sep 17 00:00:00 2001
From: ansgarz <ansgar.zwick@meissa.de>
Date: Fri, 21 Feb 2025 11:38:29 +0100
Subject: [PATCH] [skip ci] replace deprecated method by checkPackage

---
 .../provs/desktop/infrastructure/VSCode.kt                    | 4 ++--
 .../provs/desktop/infrastructure/Zim.kt                       | 4 ++--
 .../provs/server/infrastructure/Ssh.kt                        | 4 ++--
 .../provs/syspec/infrastructure/Verification.kt               | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/VSCode.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/VSCode.kt
index 7a3b22c..cc211c3 100644
--- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/VSCode.kt
+++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/VSCode.kt
@@ -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("""
diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Zim.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Zim.kt
index 49880f1..0d869be 100644
--- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Zim.kt
+++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Zim.kt
@@ -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")
diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/Ssh.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/Ssh.kt
index 6f05497..0752289 100644
--- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/Ssh.kt
+++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/Ssh.kt
@@ -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",
diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/Verification.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/Verification.kt
index bee923e..25d238f 100644
--- a/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/Verification.kt
+++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/Verification.kt
@@ -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.")
 }