[pve-devel] [PATCH common] print_property_string: don't print the default key's name

Wolfgang Bumiller w.bumiller at proxmox.com
Thu May 19 11:33:45 CEST 2016


We had this behavior in the past and didn't mean to change
it.
---
 src/PVE/JSONSchema.pm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index f90d98c..1da7494 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -1596,7 +1596,7 @@ sub print_property_string {
     my $done = { map { $_ => 1 } @$skip };
 
     my $cond_add_key = sub {
-	my ($key) = @_;
+	my ($key, $isdefault) = @_;
 
 	return if $done->{$key}; # avoid duplicates
 
@@ -1628,11 +1628,15 @@ sub print_property_string {
 	die "internal error" if defined($phash->{alias});
 
 	my $value_str = &$format_value($key, $value, $phash->{format});
-	&$add_option_string("$key=${value_str}");
+	if ($isdefault) {
+	    &$add_option_string($value_str);
+	} else {
+	    &$add_option_string("$key=${value_str}");
+	}
     };
 
     # add default key first
-    &$cond_add_key($default_key) if defined($default_key);
+    &$cond_add_key($default_key, 1) if defined($default_key);
 
     # add required keys first
     foreach my $key (sort keys %$data) {
-- 
2.1.4





More information about the pve-devel mailing list