Merge remote-tracking branch 'origin/main'

This commit is contained in:
zam 2025-04-09 14:08:11 +02:00
commit 1595eccbb7
3 changed files with 11 additions and 6 deletions
src
main
kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/scheduledjobs/domain
resources
test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure

View file

@ -9,7 +9,9 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.scheduledjobs.infrast
* ATTENTION: Use with care!! System will be shut down, restart might not succeed in all cases.
*/
fun Prov.scheduleMonthlyReboot() = task {
// reboot each first Tuesday a month - see https://blog.healthchecks.io/2022/09/schedule-cron-job-the-funky-way/
// reboot each first Tuesday a month - see also https://blog.healthchecks.io/2022/09/schedule-cron-job-the-funky-way/
// Day of month field "*/100,1-7" means “every 100 days starting from date 1, and also on dates 1-7”.
// Since there are no months with 100 days, this means “on dates 1 to 7” that are also (in this case) Tuesdays, which is exactly each first Tuesday in a month.
val schedule = "0 2 */100,1-7 * TUE"
createCronJob("50_monthly_reboot", schedule, "/sbin/shutdown", "-r now", "root")
}

View file

@ -1 +1 @@
0.40.4-SNAPSHOT
0.40.6-SNAPSHOT

View file

@ -3,8 +3,7 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.remote
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.deleteFile
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileContainsText
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackageInstalled
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackage
import org.domaindrivenarchitecture.provs.framework.ubuntu.secret.secretSources.PromptSecretSource
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
@ -34,7 +33,7 @@ internal class FirefoxKtTest {
assertTrue(result.success)
assertEquals("Firefox already installed with ppa", result2.out)
assertTrue(prov.isPackageInstalled("firefox"))
assertTrue(prov.checkPackage("firefox"))
assertTrue(
prov.fileContainsText(
"/etc/apt/apt.conf.d/51unattended-upgrades-firefox",
@ -69,7 +68,11 @@ internal class FirefoxKtTest {
).session {
installPpaFirefox()
firefoxVersion = cmd("apt list firefox --installed").out ?: ""
checkPackageInstalled("firefox")
if (checkPackage("firefox")) {
addResult(true, "Firefox installed")
} else {
addResult(false, "Firefox not installed")
}
}
// then