public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths
Date: Thu, 16 May 2024 11:45:29 +0200	[thread overview]
Message-ID: <1715852270.debtfaacfe.astroid@yuna.none> (raw)
In-Reply-To: <20240515103213.455567-3-a.lauterer@proxmox.com>

On May 15, 2024 12:32 pm, Aaron Lauterer wrote:
> The first instance had the line break mid array. It now is a bit over
> the limit, but follows the style guide closely: putting each argument to
> the function in a newline.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
>  src/PVE/CLI/pvecm.pm | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
> index 5c285a9..53e9cac 100755
> --- a/src/PVE/CLI/pvecm.pm
> +++ b/src/PVE/CLI/pvecm.pm
> @@ -210,10 +210,10 @@ __PACKAGE__->register_method ({
>  	    my ($node, $ip) = @_;
>  	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>  	    my $outsub = sub { print "\nnode '$node': " . shift };
> -	    run_command([
> -		    @$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c",
> -		    "/etc/pve/$p12_file_base"], outfunc => \&$outsub
> -		);
> +	    run_command(
> +		[@$ssh_cmd, @$ssh_options, $ip, "$qdevice_certutil", "-m", "-c", "/etc/pve/$p12_file_base"],
> +		outfunc => \&$outsub

this would then be even shorter if the options can be dropped
altogether. and while we are at it:

outfunc => $outsub

no need for symbol salad here :)

I don't mind the arg-per-line even if it would be below the limit then,
but as an alternative, you can always construct the full command first
to make the run_command line shorter.

e.g.:

my $cluster_ssh_cmd = PVE::SSHInfo::ssh_info_to_command({ ip => $ip, name => $node });
my $cmd = [@$cluster_ssh_cmd, '--', $qdevice_certutil, '-m', '-c', "/etc/pve/$p12_file_base"];
run_command($cmd, outfunc => $outsub);

but that is mainly a matter of taste I'd say.

> +	    );
>  	});
>  	unlink "/etc/pve/$p12_file_base";
>  
> @@ -249,8 +249,14 @@ __PACKAGE__->register_method ({
>  	    my $ssh_options = PVE::SSHInfo::ssh_info_to_ssh_opts ({ ip => $ip, name => $node });
>  	    my $outsub = sub { print "\nnode '$node': " . shift };
>  	    print "\nINFO: start and enable corosync qdevice daemon on node '$node'...\n";
> -	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'], outfunc => \&$outsub);
> -	    run_command([@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'], outfunc => \&$outsub);
> +	    run_command(
> +		[@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'start', 'corosync-qdevice'],
> +		outfunc => \&$outsub
> +	    );
> +	    run_command(
> +		[@$ssh_cmd, @$ssh_options, $ip, 'systemctl', 'enable', 'corosync-qdevice'],
> +		outfunc => \&$outsub
> +	    );

same as above applies here as well

>  	});
>  
>  	run_command(['corosync-cfgtool', '-R']); # do cluster wide config reload
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2024-05-16  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15 10:32 [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer
2024-05-15 10:32 ` [pve-devel] [PATCH cluster 1/2] fix #5461: pvecm: ssh: adapt intra cluster ssh options Aaron Lauterer
2024-05-16 10:17   ` Fabian Grünbichler
2024-05-16 10:38     ` Aaron Lauterer
2024-05-15 10:32 ` [pve-devel] [PATCH cluster 2/2] pvecm: qdevice: adjust line lengths Aaron Lauterer
2024-05-16  9:45   ` Fabian Grünbichler [this message]
2024-05-21  7:12 ` [pve-devel] [PATCH cluster 0/2] fix #5461: qdevice cluster mgmt Aaron Lauterer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1715852270.debtfaacfe.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal