[pve-devel] r5150 - pve-common/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Sep 14 12:46:54 CEST 2010


Author: dietmar
Date: 2010-09-14 10:46:54 +0000 (Tue, 14 Sep 2010)
New Revision: 5150

Modified:
   pve-common/trunk/ChangeLog
   pve-common/trunk/JSONSchema.pm
Log:
* JSONSchema.pm (get_standard_option): allow to set defaults.


Modified: pve-common/trunk/ChangeLog
===================================================================
--- pve-common/trunk/ChangeLog	2010-09-14 10:23:53 UTC (rev 5149)
+++ pve-common/trunk/ChangeLog	2010-09-14 10:46:54 UTC (rev 5150)
@@ -1,5 +1,7 @@
 2010-09-14  Proxmox Support Team  <support at proxmox.com>
 
+	* JSONSchema.pm (get_standard_option): allow to set defaults.
+
 	* RPCEnvironment.pm (get_nodelist): new helper
 
 	* RESTHandler.pm (register_method): do not validate method (that

Modified: pve-common/trunk/JSONSchema.pm
===================================================================
--- pve-common/trunk/JSONSchema.pm	2010-09-14 10:23:53 UTC (rev 5149)
+++ pve-common/trunk/JSONSchema.pm	2010-09-14 10:46:54 UTC (rev 5150)
@@ -34,10 +34,18 @@
 }
 
 sub get_standard_option {
-    my ($name) = @_;
+    my ($name, $base) = @_;
 
-    my $res =  $standard_options->{$name};
-    die "no such standard option\n" if !$res;
+    my $std =  $standard_options->{$name};
+    die "no such standard option\n" if !$std;
+
+    my $res = $base || {};
+
+    foreach my $opt (keys %$std) {
+	next if $res->{$opt};
+	$res->{$opt} = $std->{$opt};
+    }
+
     return $res;
 };
 




More information about the pve-devel mailing list