[pmg-devel] [PATCH pmg-api 1/2] utils: fix service_aliases usage

Stoiko Ivanov s.ivanov at proxmox.com
Wed Jun 30 18:39:54 CEST 2021


2 errors were introduced in 4f06ff8ac21baa5736060221191fb109e20d8e37:

* a typo in the postgresql service name
* it missed the other uses of the service_name hash, apart from the
  lookup_real_service_name sub.

both fixed here

Reported-by: Martin Maurer <martin at proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/Utils.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index 318c7b3..09999d8 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -717,7 +717,7 @@ sub lookup_real_service_name {
 
     if ($alias eq 'postgres') {
 	my $pg_ver = get_pg_server_version();
-	return "postgresl\@${pg_ver}-main";
+	return "postgresql\@${pg_ver}-main";
     }
 
     return $service_aliases->{$alias} // $alias;
@@ -735,7 +735,7 @@ sub get_full_service_state {
 	}
     };
 
-    $service = $service_aliases->{$service} // $service;
+    $service = lookup_real_service_name($service);
     PVE::Tools::run_command(['systemctl', 'show', $service], outfunc => $parser);
 
     return $res;
@@ -790,7 +790,7 @@ sub service_cmd {
 	$cmd = 'restart' if $cmd eq 'start';
     }
 
-    $service = $service_aliases->{$service} // $service;
+    $service = lookup_real_service_name($service);
     PVE::Tools::run_command(['systemctl', $cmd, $service]);
 };
 
-- 
2.20.1





More information about the pmg-devel mailing list