[pve-devel] r5130 - pve-common/trunk
svn-commits at proxmox.com
svn-commits at proxmox.com
Tue Sep 14 09:54:42 CEST 2010
Author: dietmar
Date: 2010-09-14 07:54:42 +0000 (Tue, 14 Sep 2010)
New Revision: 5130
Modified:
pve-common/trunk/ChangeLog
pve-common/trunk/JSONSchema.pm
pve-common/trunk/RESTHandler.pm
Log:
* RESTHandler.pm (register_method): do not validate method (that
is too slow - delays startup).
(validate_method_schemas): new method to validate all registered
methods. We can no do that once when we create a package.
Modified: pve-common/trunk/ChangeLog
===================================================================
--- pve-common/trunk/ChangeLog 2010-09-14 06:58:47 UTC (rev 5129)
+++ pve-common/trunk/ChangeLog 2010-09-14 07:54:42 UTC (rev 5130)
@@ -1,3 +1,10 @@
+2010-09-14 Proxmox Support Team <support at proxmox.com>
+
+ * RESTHandler.pm (register_method): do not validate method (that
+ is too slow - delays startup).
+ (validate_method_schemas): new method to validate all registered
+ methods. We can no do that once when we create a package.
+
2010-09-13 Proxmox Support Team <support at proxmox.com>
* JSONSchema.pm (validate): add minLength/maxLength to the default
Modified: pve-common/trunk/JSONSchema.pm
===================================================================
--- pve-common/trunk/JSONSchema.pm 2010-09-14 06:58:47 UTC (rev 5129)
+++ pve-common/trunk/JSONSchema.pm 2010-09-14 07:54:42 UTC (rev 5130)
@@ -645,6 +645,14 @@
description => "method needs special privileges - only pvedaemon can execute it",
optional => 1,
},
+ match_name => {
+ description => "Used internally",
+ optional => 1,
+ },
+ match_re => {
+ description => "Used internally",
+ optional => 1,
+ },
path => {
type => 'string',
description => "path for URL matching (uri template)",
Modified: pve-common/trunk/RESTHandler.pm
===================================================================
--- pve-common/trunk/RESTHandler.pm 2010-09-14 06:58:47 UTC (rev 5129)
+++ pve-common/trunk/RESTHandler.pm 2010-09-14 07:54:42 UTC (rev 5130)
@@ -17,10 +17,27 @@
our $AUTOLOAD; # it's a package global
+sub validate_method_schemas {
+
+ foreach my $class (keys %$method_registry) {
+ my $ma = $method_registry->{$class};
+
+ foreach my $info (@$ma) {
+ #syslog ('info', "TEST0 " . Dumper($info));
+ if ($info->{subclass}) {
+ validate_method_schemas($info->{subclass});
+ } else {
+ print "VALIDATE: ${class}::$info->{name}\n";
+ PVE::JSONSchema::validate_method_info($info);
+ }
+ }
+ }
+}
+
sub register_method {
my ($self, $info) = @_;
- PVE::JSONSchema::validate_method_info($info);
+ # PVE::JSONSchema::validate_method_info($info);
my $match_re = [];
my $match_name = [];
More information about the pve-devel
mailing list