[pve-devel] [PATCH cluster] setup_sshd_config: remove useless start_sshd parameter

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 23 09:57:59 CET 2017


This controlled if we use reload-or-restart or try-reload-or-restart.
They differ in the following way:
> reload-or-restart - Reload one or more units if possible, otherwise
> start or restart
>
> try-reload-or-restart - Reload one or more units if possible,
> otherwise (re)start if active

Under PVE we normally need a running ssh for a node/cluster to work,
there isn't the case where it should be stopped, especially not for
this method which is normally called when setting up or joining a
cluster.
So always use 'reload-or-restart'.

Semantically reverts: 6c0e95b3

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/PVE/CLI/pvecm.pm | 2 +-
 data/PVE/Cluster.pm   | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index 9437368..e23f7e0 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -503,7 +503,7 @@ __PACKAGE__->register_method ({
 
 	my $nodename = PVE::INotify::nodename();
 
-	PVE::Cluster::setup_sshd_config(1);
+	PVE::Cluster::setup_sshd_config();
 	PVE::Cluster::setup_rootsshconfig();
 	PVE::Cluster::setup_ssh_keys();
 
diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index fef5842..5223203 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1115,7 +1115,7 @@ sub ssh_merge_keys {
 }
 
 sub setup_sshd_config {
-    my ($start_sshd) = @_;
+    my () = @_;
 
     my $conf = PVE::Tools::file_get_contents($sshd_config_fn);
 
@@ -1128,8 +1128,7 @@ sub setup_sshd_config {
 
     PVE::Tools::file_set_contents($sshd_config_fn, $conf);
 
-    my $cmd = $start_sshd ? 'reload-or-restart' : 'reload-or-try-restart';
-    PVE::Tools::run_command(['systemctl', $cmd, 'sshd']);
+    PVE::Tools::run_command(['systemctl', 'reload-or-restart', 'sshd']);
 }
 
 sub setup_rootsshconfig {
-- 
2.11.0





More information about the pve-devel mailing list