public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Max Carrara <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH manager] fix #4364: pveceph: add confirmation dialogue for ceph installation
Date: Mon, 3 Jul 2023 11:39:38 +0200	[thread overview]
Message-ID: <015c86d0-c4c2-ae83-3e11-bb3e88ea104e@proxmox.com> (raw)
In-Reply-To: <20230222142304.93093-1-m.carrara@proxmox.com>

On 2/22/23 15:23, Max Carrara wrote:
> Displays a confirmation dialogue if the user didn't explicitly
> provide a valid ceph version via the `--version` flag and if
> stdout is connected to a tty.
> 
> Signed-off-by: Max Carrara <m.carrara@proxmox.com>
> ---
>  PVE/CLI/pveceph.pm | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> Note: This was tested in a VM, with and without --version flag.
> 
> diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm
> index afcc67e0..eaf7918e 100755
> --- a/PVE/CLI/pveceph.pm
> +++ b/PVE/CLI/pveceph.pm
> @@ -157,6 +157,19 @@ __PACKAGE__->register_method ({
>  	} else {
>  	    die "unsupported ceph version: $cephver";
>  	}
> +
> +	if (-t STDOUT && !$param->{version}) {
> +	    my $title_case_cephver = $cephver =~ s/(.)(.*?)/\U$1\L$2/r ;
> +
> +	    print "This will install Ceph $title_case_cephver.\n" .
> +		"Are you sure you want to proceed (yes/no)? ";
> +
> +	    my $answer = <STDIN>;
> +	    my $valid = ($answer =~ m/^\s*yes\s*$/i) ? 1 : 0;
> +
> +	    die "Aborting installation.\n" if !$valid;
> +	}
> +
>  	PVE::Tools::file_set_contents("/etc/apt/sources.list.d/ceph.list", $repolist);
>  
>  	my $supported_re = join('|', $supported_ceph_versions->@*);

Ping - just applied this on master[0] and tested it.

Though, I'm not sure if this still necessary, as we only support
Quincy atm; but might become relevant once Reef is released, I suppose.

[0] as of commit 50bcf799d8435b794fe2a79a74aa6df6a1419292




  reply	other threads:[~2023-07-03  9:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 14:23 Max Carrara
2023-07-03  9:39 ` Max Carrara [this message]
2023-07-04  6:38 ` Thomas Lamprecht

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=015c86d0-c4c2-ae83-3e11-bb3e88ea104e@proxmox.com \
    --to=m.carrara@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