From 9e4879d9c81188a89260d25b0fa70ddbe1a53cf4 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 1 Nov 2023 15:20:23 +0100 Subject: [PATCH 1/3] python3.9 -> python3 --- manifests/script.pp | 8 ++++---- templates/script/restart-db-cluster.erb | 2 +- templates/script/restart-nextcloud-farm.erb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/script.pp b/manifests/script.pp index 9229c96..10a0bdc 100644 --- a/manifests/script.pp +++ b/manifests/script.pp @@ -72,7 +72,7 @@ class sunetdrive::script ( ensure => installed, provider => apt, } - package { 'python3.9': + package { 'python3': ensure => installed, provider => apt, } @@ -82,9 +82,9 @@ class sunetdrive::script ( } $drive_version = '0.3.1' exec { 'drive-utils': - command => "python3.9 -m pip install https://pypi.sunet.se/packages/drive-utils-${drive_version}.tar.gz", - unless => "python3.9 -m pip list | grep drive-utils | grep ${drive_version}", - require => Package['python3.9'], + command => "python3 -m pip install https://pypi.sunet.se/packages/drive-utils-${drive_version}.tar.gz", + unless => "python3 -m pip list | grep drive-utils | grep ${drive_version}", + require => Package['python3'], } file { '/root/.ssh/': ensure => directory, diff --git a/templates/script/restart-db-cluster.erb b/templates/script/restart-db-cluster.erb index c5ab40a..6ea18ba 100755 --- a/templates/script/restart-db-cluster.erb +++ b/templates/script/restart-db-cluster.erb @@ -1,4 +1,4 @@ -#!/usr/bin/env python3.9 +#!/usr/bin/env python3 # vim: set filetype=python: import subprocess diff --git a/templates/script/restart-nextcloud-farm.erb b/templates/script/restart-nextcloud-farm.erb index d68c8a4..05321a2 100755 --- a/templates/script/restart-nextcloud-farm.erb +++ b/templates/script/restart-nextcloud-farm.erb @@ -1,4 +1,4 @@ -#!/usr/bin/env python3.9 +#!/usr/bin/env python3 # vim: set filetype=python: import subprocess From df731fdb441109045125b9ac868b5df48ff8428e Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 1 Nov 2023 15:25:31 +0100 Subject: [PATCH 2/3] Force installation of drive-utils --- manifests/script.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/script.pp b/manifests/script.pp index 10a0bdc..7c1bd00 100644 --- a/manifests/script.pp +++ b/manifests/script.pp @@ -82,7 +82,7 @@ class sunetdrive::script ( } $drive_version = '0.3.1' exec { 'drive-utils': - command => "python3 -m pip install https://pypi.sunet.se/packages/drive-utils-${drive_version}.tar.gz", + command => "python3 -m pip install --break-system-packages https://pypi.sunet.se/packages/drive-utils-${drive_version}.tar.gz", unless => "python3 -m pip list | grep drive-utils | grep ${drive_version}", require => Package['python3'], } From ed65bb0d94493804dc450eb2726fef2810af1453 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 1 Nov 2023 16:31:24 +0100 Subject: [PATCH 3/3] Use other command in debian --- manifests/script.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manifests/script.pp b/manifests/script.pp index 7c1bd00..ce0a33d 100644 --- a/manifests/script.pp +++ b/manifests/script.pp @@ -81,8 +81,14 @@ class sunetdrive::script ( provider => apt, } $drive_version = '0.3.1' + if $facts['os']['name'] == 'Debian' { + $pip_cmd = 'pip3 install --break-system-packages' + } else { + $pip_cmd = 'python3 -m pip install' + + } exec { 'drive-utils': - command => "python3 -m pip install --break-system-packages https://pypi.sunet.se/packages/drive-utils-${drive_version}.tar.gz", + command => "${pip_cmd} https://pypi.sunet.se/packages/drive-utils-${drive_version}.tar.gz", unless => "python3 -m pip list | grep drive-utils | grep ${drive_version}", require => Package['python3'], }