public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	Max Carrara <m.carrara@proxmox.com>
Cc: w.bumiller@proxmox.com
Subject: Re: [pbs-devel] [PATCH vma-to-pbs 04/10] Add the ability to provide credentials via files
Date: Mon, 25 Mar 2024 16:26:20 +0100	[thread overview]
Message-ID: <1b6a8787-4b52-4ea0-b3e6-2c5e0b530f1b@proxmox.com> (raw)
In-Reply-To: <D02U1N6CGQKL.2PCM24CI3WPFD@proxmox.com>

Am 25/03/2024 um 13:33 schrieb Max Carrara:
> On Wed Mar 20, 2024 at 3:15 PM CET, Filip Schauer wrote:
>> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
>> ---
>>  src/main.rs | 31 +++++++++++++++++++++++++++++--
>>  1 file changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/main.rs b/src/main.rs
>> index 8d95b11..b58387b 100644
>> --- a/src/main.rs
>> +++ b/src/main.rs
>> @@ -280,6 +280,18 @@ fn main() -> Result<()> {
>>                  .help("Encrypt the Backup")
>>                  .action(ArgAction::SetTrue),
>>          )
>> +        .arg(
>> +            Arg::new("password_file")
>> +                .long("password_file")
>> +                .value_name("PASSWORD_FILE")
>> +                .help("Password file"),
>> +        )
>> +        .arg(
>> +            Arg::new("key_password_file")
>> +                .long("key_password_file")
>> +                .value_name("KEY_PASSWORD_FILE")
>> +                .help("Key password file"),
>> +        )
>>          .arg(Arg::new("vma_file"))
>>          .get_matches();
> 
> One thing I had noticed when using the CLI: Would it maaaybe be nicer to
> use e.g. --password-file instead of --password_file? AFAIR @Wolfgang
> mentioned something regarding this off list.

yes, we use kebab-case for all new (CLI & API) options if anyhow possible, please!


btw. is clap really required here? Our usage in the past has shown that it's
rather a huge maintenance burden, and so I'd like to prefer using pico-args.
You can use the clap usage output as source for a manual implemented usage
though (extending that then in the future isn't that much work).

For a conversion example and some more background see:
https://git.proxmox.com/?p=pve-xtermjs.git;a=commitdiff;h=24d707d0506b120a085b06b5f2b6000696879a1e;hp=749ebb0907293a9f1cf0f5074e0a240f39f94f6f

Note though that I would not block clap usage for now, but there's a
significant possibility that I'll rip it out on the next clap major bump
in anyway.

> 
>>  
>> @@ -296,10 +308,25 @@ fn main() -> Result<()> {
>>      let encrypt = matches.get_flag("encrypt");
>>  
>>      let vma_file_path = matches.get_one::<String>("vma_file").unwrap().to_string();
>> +    let password_file = matches.get_one::<String>("password_file");
>> +
>> +    let pbs_password = match password_file {
>> +        Some(password_file) => {
>> +            std::fs::read_to_string(password_file).expect("Could not read password file")
> 
> You changed this later and got rid of the undying, but that fix could've
> perhaps been in here already.

yeah, not that big of an issue on such initial additions, but if we somehow
can avoid intermediate breakage or the like it's always better.




  reply	other threads:[~2024-03-25 15:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 14:15 [pbs-devel] [PATCH v5 vma-to-pbs 00/10] Implement vma-to-pbs tool Filip Schauer
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 01/10] Initial commit Filip Schauer
2024-03-25  9:42   ` Filip Schauer
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 02/10] cargo fmt Filip Schauer
2024-03-25  9:43   ` Filip Schauer
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 03/10] bump proxmox-backup-qemu Filip Schauer
2024-03-25  9:43   ` Filip Schauer
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 04/10] Add the ability to provide credentials via files Filip Schauer
2024-03-25 12:33   ` Max Carrara
2024-03-25 15:26     ` Thomas Lamprecht [this message]
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 05/10] bump proxmox-backup-qemu Filip Schauer
2024-03-25 12:33   ` Max Carrara
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 06/10] remove unnecessary "extern crate" declarations Filip Schauer
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 07/10] add support for streaming the VMA file via stdin Filip Schauer
2024-03-25 12:34   ` Max Carrara
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 08/10] add a fallback for the --fingerprint argument Filip Schauer
2024-03-25 12:35   ` Max Carrara
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 09/10] refactor error handling with anyhow Filip Schauer
2024-03-25 12:35   ` Max Carrara
2024-03-20 14:15 ` [pbs-devel] [PATCH vma-to-pbs 10/10] Makefile: remove reference to unused submodule Filip Schauer
2024-03-25 12:38 ` [pbs-devel] [PATCH v5 vma-to-pbs 00/10] Implement vma-to-pbs tool Max Carrara
2024-03-25 12:52   ` Wolfgang Bumiller
2024-04-03  9:56 ` Filip Schauer

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=1b6a8787-4b52-4ea0-b3e6-2c5e0b530f1b@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=m.carrara@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=w.bumiller@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