[pve-devel] [PATCH v2 common] fix #1942: workaround for 'quiet' option conflict
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Oct 9 08:54:47 CEST 2018
On 10/8/18 3:19 PM, David Limbeck wrote:
> workaround for option 'quiet' in VZDump conflicting with
> standard_output_options in RESTHandler.pm. this change is not limited to
> 'quiet' but also allows other options to be overridden as long as their
> type property matches.
>
> Signed-off-by: David Limbeck <d.limbeck at proxmox.com>
> ---
> This workaround was proposed by Dietmar. Any better solution?
>
very strange concept. So an option can be overwritten, even if semantically
completely different (and possible "more" dangerous), on the sole basis that
the share the same type?
Honestly, I would just ignore default options for now if there is already an
existing one, then once we discussed them and CLIFormatter stuff and actually
want those in and enabled we can start with warning if a property is redefined,
so that we can fix all remaining occurrences. Once we're sure and checked all
CLIHandler descendants we could actually transform this in a die here - if still
needed/deemed good.
> src/PVE/RESTHandler.pm | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
> index f645f1b..92a0c9e 100644
> --- a/src/PVE/RESTHandler.pm
> +++ b/src/PVE/RESTHandler.pm
> @@ -810,7 +810,13 @@ sub add_standard_output_properties {
>
> foreach my $opt (@$list) {
> die "no such standard output option '$opt'\n" if !defined($standard_output_options->{$opt});
> - die "detected overwriten standard CLI parameter '$opt'\n" if defined($res->{$opt});
> + if (defined($res->{$opt})) {
> + my $opt_type = $standard_output_options->{$opt}->{type};
> + my $res_opt_type = $res->{$opt}->{type};
> + if ($res_opt_type ne $opt_type) {
> + die "detected overridden standard CLI parameter '$opt'\n";
> + }
> + }
> $res->{$opt} = $standard_output_options->{$opt};
> }
>
>
More information about the pve-devel
mailing list