]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
fence config: allow to pass arguments to fence agents via short-opts
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 8 Jan 2019 14:21:48 +0000 (15:21 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 8 Jan 2019 14:28:06 +0000 (15:28 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/FenceConfig.pm

index df25fae9415d40679df71f21268af9d916c9c265..3ab00826ff0ea7304c8dbbdf90b141bb233a8ffd 100644 (file)
@@ -2,6 +2,7 @@ package PVE::HA::FenceConfig;
 
 use strict;
 use warnings;
+
 use PVE::Tools;
 
 sub parse_config {
@@ -124,10 +125,13 @@ sub gen_arg_str {
     foreach my $arg (@arguments) {
        my ($key, $val) = split /=/, $arg;
        # we need to differ long and short opts!
-       my $prefix = (length($key) == 1) ? '-' : '--';
-       # shellquote values and add them again
-       $key  .= '='. PVE::Tools::shellquote($val) if $val;
-       push @shell_args, "$prefix$key";
+       if (length($key) == 1) {
+           push @shell_args, "-${key}";
+           push @shell_args, PVE::Tools::shellquote($val) if defined($val);
+       } else {
+           $key  .= '='. PVE::Tools::shellquote($val) if defined($val);
+           push @shell_args, "--$key";
+       }
     }
 
     return join (' ', @shell_args);