Re: [pve-devel] [PATCH storage] storage: add bzip2 support

2024-08-02 Thread Stoiko Ivanov
In general I think the addition of bz2 for ISOs makes sense (if only for OPNSense's sake) - Thanks for addressing this! You want to add bzip2 as dependency to debian/control we probably should also add lzop, zstd, gzip to the dependencies although they are pulled in as dependency of pve-manger (d

[pve-devel] [PATCH manager] ui: allow decompressing ISO compressed with bz2

2024-08-02 Thread Maximiliano Sandoval
Signed-off-by: Maximiliano Sandoval --- This is a follow-up of the patch: [PATCH storage] storage: add bzip2 support which can be found at [1]. [1] https://lists.proxmox.com/pipermail/pve-devel/2024-August/065030.html www/manager6/window/DownloadUrlToStorage.js | 3 ++- 1 file changed,

[pve-devel] [PATCH storage] storage: add bzip2 support

2024-08-02 Thread Maximiliano Sandoval
This was requested at [1]. [1] https://bugzilla.proxmox.com/show_bug.cgi?id=5267 Suggested-by: Stoiko Ivanov Signed-off-by: Maximiliano Sandoval --- For the sake of not having a commit where tests fail, this is all in one commit. Please tell me if I should split it. The idea is to expose this

[pve-devel] [PATCH v1 pve-common 18/18] deb: split PBSClient.pm into new package libproxmox-backup-client-perl

2024-08-02 Thread Max Carrara
.. and also add corresponding 'debian/*.install' files for 'libpve-common-perl' and the new package. Signed-off-by: Max Carrara --- Makefile | 1 + debian/control | 12 + debian/libproxmox-backup-client-perl.install | 1

[pve-devel] [PATCH v1 pve-common 16/18] pbsclient: don't return anything in `forget_snapshot`

2024-08-02 Thread Max Carrara
The actual `proxmox-backup-client forget` command doesn't return anything (despite the `--output-format json` flag), which is why this method ends up returning `undef` on successful calls (due to the JSON parse in `run_client_cmd` returning `undef`). Therefore, make it explicit that nothing is ret

[pve-devel] [PATCH v1 pve-common 15/18] pbsclient: don't return anything in PXAR methods

2024-08-02 Thread Max Carrara
Due to the previously removed implicit return in `do_raw_client_cmd`, the `run_raw_client_cmd` and consequently also the `backup_fs_tree` and `restore_pxar` methods would return `0` on success if they didn't `die` otherwise. Therefore, because now nothing is actually returned, explicitly don't ret

[pve-devel] [PATCH v1 pve-common 12/18] pbsclient: throw exception if username of client has no realm

2024-08-02 Thread Max Carrara
.. in order to catch that error earlier, rather than having `proxmox-backup-client` err and complain that the "repository value doesn't match the regex pattern". Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PVE/PBSClient.pm b/src/P

[pve-devel] [PATCH v1 pve-common 17/18] make: support building multiple packages from the same source

2024-08-02 Thread Max Carrara
This also makes sure that `lintian` actually lints any new packages. Signed-off-by: Max Carrara --- Makefile | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 637cd49..c2969aa 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +

[pve-devel] [PATCH v1 pve-common 10/18] pbsclient: use `File::Spec->catfile` to concatenate file paths

2024-08-02 Thread Max Carrara
Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index 2084bb5..69b4e40 100644 --- a/src/PVE/PBSClient.pm +++ b/src/PVE/PBSClient.pm @@ -5,6 +5,7 @@ use warnings

[pve-devel] [PATCH v1 pve-common 09/18] pbsclient: create secret dir with `mkdir -p` and mode `700`

2024-08-02 Thread Max Carrara
.. instead of using a regular `mkdir` call. The `File::Path::make_path` subroutine is used for this purpose, which recursively creates all directories if they didn't exist before. Upon creation of those directories, the mode is also set to `700`. This means that (like before), directory permissio

[pve-devel] [PATCH v1 pve-common 08/18] pbsclient: document package and its public functions & methods

2024-08-02 Thread Max Carrara
This commit adds a brief overview for the `PVE::PBSClient` package and documents its public functions and methods. Examples are added where deemed appropriate. Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 526 +-- 1 file changed, 511 insertions(+)

[pve-devel] [PATCH v1 pve-common 14/18] pbsclient: prohibit implicit return

2024-08-02 Thread Max Carrara
.. for the `set_password`, `set_encryption_key` and `do_raw_client_cmd` methods. This makes it very clear that these methods aren't supposed to return anything. In the case of `do_raw_client_cmd` in particular, the implicit return of `0` on success (would be `undef` if the command failed) was neve

[pve-devel] [PATCH v1 pve-common 06/18] pbsclient: use spaces around list braces and parens around ternaries

2024-08-02 Thread Max Carrara
Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index d707971..d3daf41 100644 --- a/src/PVE/PBSClient.pm +++ b/src/PVE/PBSClient.pm @@ -216,7 +216,7 @@ my sub run_client_

[pve-devel] [PATCH v1 pve-common 13/18] pbsclient: make method `password_file_name` public

2024-08-02 Thread Max Carrara
.. in order to allow users to only store a password if the password file doesn't exist yet, for example. Also adds corresponding documentation. Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PVE/PBSClient

[pve-devel] [PATCH v1 pve-common 11/18] pbsclient: let `status` method return a hash instead of an array

2024-08-02 Thread Max Carrara
Instead of returning an (arguably awkward) array with four elements, where each element has a special meaning, return the hash that is constructed from the `proxmox-backup-client status` command's JSON output. The documentation is updated accordingly. This method isn't used anywhere in our code b

[pve-devel] [PATCH v1 pve-common 05/18] pbsclient: use cond. statements instead of chained 'or' operators

2024-08-02 Thread Max Carrara
.. like in the `delete_encryption_key` subroutine below, as it's more readable at a glance. Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index ab1fa62..d707971 100644 --- a/

[pve-devel] [PATCH v1 pve-common 04/18] pbsclient: pull variable out of long post-if definedness check

2024-08-02 Thread Max Carrara
Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index 525b37f..ab1fa62 100644 --- a/src/PVE/PBSClient.pm +++ b/src/PVE/PBSClient.pm @@ -288,7 +288,9 @@ sub backup_fs_tree {

[pve-devel] [PATCH v1 pve-common 02/18] pbsclient: use parentheses when calling most inbuilts

2024-08-02 Thread Max Carrara
.. except for really common cases like `die`, `warn`, `keys`. Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 46 ++-- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index a1536e6..3e98dd1

[pve-devel] [PATCH v1 pve-common 07/18] pbsclient: s/foreach/for

2024-08-02 Thread Max Carrara
Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index d3daf41..231406a 100644 --- a/src/PVE/PBSClient.pm +++ b/src/PVE/PBSClient.pm @@ -348,7 +348,7 @@ sub prune_group { pus

[pve-devel] [PATCH v1 pve-common 03/18] pbsclient: use post-if definedness checks instead of '//=' operator

2024-08-02 Thread Max Carrara
Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index 3e98dd1..525b37f 100644 --- a/src/PVE/PBSClient.pm +++ b/src/PVE/PBSClient.pm @@ -208,7 +208,7 @@ my sub run_client_cmd :

[pve-devel] [PATCH v1 pve-common 01/18] pbsclient: rename 'sdir' parameter of constructor to 'secret_dir'

2024-08-02 Thread Max Carrara
.. so that it's less ambiguous for what the parameter stands for at a glance. Signed-off-by: Max Carrara --- src/PVE/PBSClient.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index e63af03..a1536e6 100644 --- a/src/PVE/PBSCli

[pve-devel] [PATCH v1 pve-common 00/18] Introduction of libproxmox-backup-client-perl

2024-08-02 Thread Max Carrara
Introduction of libproxmox-backup-client-perl - v1 == Description --- This series' main goal is to split the `PVE::PBSClient` Perl module from the `libpve-common-perl` Debian package while improving and documenting its code. The new `libprox

[pve-devel] [PATCH proxmox-perl-rs v2 11/15] pmg-rs: tfa: clippy: the borrowed expression implements the required traits

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pmg-rs/src/tfa.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmg-rs/src/tfa.rs b/pmg-rs/src/tfa.rs index 928b50b..af69721 100644 --- a/pmg-rs/src/tfa.rs +++ b/pmg-rs/src/tfa.rs @@ -178,7 +178,7 @@ mod export { #[try_from_ref] t

[pve-devel] [PATCH proxmox-perl-rs v2 12/15] pmg-rs: tfa: clippy: useless conversion to the same type

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pmg-rs/src/tfa.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmg-rs/src/tfa.rs b/pmg-rs/src/tfa.rs index af69721..4e9ce8f 100644 --- a/pmg-rs/src/tfa.rs +++ b/pmg-rs/src/tfa.rs @@ -178,7 +178,7 @@ mod export { #[try_from_ref] this:

[pve-devel] [PATCH proxmox-perl-rs v2 13/15] pmg-rs: acme: clippy: reference is immediately deref'd by the compiler

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pmg-rs/src/acme.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmg-rs/src/acme.rs b/pmg-rs/src/acme.rs index 7ea78c6..e2e7327 100644 --- a/pmg-rs/src/acme.rs +++ b/pmg-rs/src/acme.rs @@ -403,7 +403,7 @@ pub mod export { this.inner

[pve-devel] [PATCH proxmox-perl-rs v2 02/15] pve-rs: tfa: clippy: this function has too many arguments

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 798cdad..6650151 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -409,6 +409,7 @@ mod export { methods::list_tfa(&this.inner.lock().

[pve-devel] [PATCH proxmox-perl-rs v2 14/15] pmg-rs: acme: simplify acount config saving

2024-08-02 Thread Lukas Wagner
We already depend on proxmox_sys, so we can just use `replace_file`. Fixing a clippy warning (missing truncate setting for OpenOptions) is an added benefit. Signed-off-by: Lukas Wagner --- pmg-rs/src/acme.rs | 62 ++ 1 file changed, 13 insertions(+), 4

[pve-devel] [PATCH proxmox-perl-rs v2 15/15] tree-wide: run cargo fmt

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- New in v2 common/src/subscription.rs | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/src/subscription.rs b/common/src/subscription.rs index d4c7227..594c778 100644 --- a/common/src/subscription.rs +++ b/common/src/subscriptio

[pve-devel] [PATCH proxmox-perl-rs v2 10/15] pmg-rs: tfa: clippy: this function has too many arguments

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pmg-rs/src/tfa.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pmg-rs/src/tfa.rs b/pmg-rs/src/tfa.rs index a97d171..928b50b 100644 --- a/pmg-rs/src/tfa.rs +++ b/pmg-rs/src/tfa.rs @@ -361,6 +361,7 @@ mod export { methods::list_tfa(&this.inner.lock().

[pve-devel] [PATCH proxmox-perl-rs v2 09/15] pmg-rs: tfa: clippy: question mark operator is useless here

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pmg-rs/src/tfa.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmg-rs/src/tfa.rs b/pmg-rs/src/tfa.rs index 0680baa..a97d171 100644 --- a/pmg-rs/src/tfa.rs +++ b/pmg-rs/src/tfa.rs @@ -441,11 +441,11 @@ mod export { #[export] fn a

[pve-devel] [PATCH proxmox-perl-rs v2 07/15] pve-rs: tfa: clippy: stripping a prefix manually

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 1054169..66dca3d 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -736,10 +736,10 @@ fn decode_old_oath_entry(

[pve-devel] [PATCH proxmox-perl-rs v2 05/15] pve-rs: tfa: clippy: accessing first element with `.get(0)`

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 7588d6d..7ead18c 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -831,7 +831,7 @@ fn generate_legacy_config(out: &mut p

[pve-devel] [PATCH proxmox-perl-rs v2 06/15] pve-rs: tfa: clippy: redundant slicing of the whole range

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 7ead18c..1054169 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -802,7 +802,7 @@ fn usize_from_perl(value: JsonValue) -> Opt

[pve-devel] [PATCH proxmox-perl-rs v2 08/15] pmg-rs: tfa: clippy: unnecessary `pub(self)`

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pmg-rs/src/tfa.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmg-rs/src/tfa.rs b/pmg-rs/src/tfa.rs index 1924488..0680baa 100644 --- a/pmg-rs/src/tfa.rs +++ b/pmg-rs/src/tfa.rs @@ -17,7 +17,7 @@ use anyhow::{bail, format_err, Error}; use n

[pve-devel] [PATCH proxmox-perl-rs v2 04/15] pve-rs: tfa: clippy: borrowed expression impls the required traits

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 9381ef0..7588d6d 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -1048,7 +1048,7 @@ impl proxmox_tfa::api::OpenUserChallengeD

[pve-devel] [PATCH proxmox-perl-rs v2 01/15] pve-rs: tfa: clippy: unnecessary `pub(self)`

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 2b61344..798cdad 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -20,7 +20,7 @@ use nix::errno::Errno; use nix::sys::stat::M

[pve-devel] [PATCH proxmox-perl-rs v2 03/15] pve-rs: tfa: clippy: question mark operator is useless here

2024-08-02 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- pve-rs/src/tfa.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pve-rs/src/tfa.rs b/pve-rs/src/tfa.rs index 6650151..9381ef0 100644 --- a/pve-rs/src/tfa.rs +++ b/pve-rs/src/tfa.rs @@ -490,11 +490,11 @@ mod export { #[export] fn a

[pve-devel] [PATCH common] inotify: avoid cyclic use statement

2024-08-02 Thread Fiona Ebner
Commit e68ebda ("fix #545: interfaces: allow arbitrary bridge names in network config") introduced a cyclic usage between PVE::RESTEnvironment and PVE::INotify, making code like the following fail: > perl -e "use PVE::RESTEnvironment qw(log_warn);" Note, including the PVE::INotify module first wo