[pve-devel] [Patch V3 acme 13/13] Implement function to resolve all subplugins

Wolfgang Link w.link at proxmox.com
Thu Apr 16 07:18:40 CEST 2020


This function helps to retrieve all subplugins
that are supported by the plugins.
This will later be used as an enumeration for entering parameters.

Signed-off-by: Wolfgang Link <w.link at proxmox.com>
---
 src/PVE/ACME.pm              | 21 +++++++++++++++++++++
 src/PVE/ACME/DNSChallenge.pm |  4 ++++
 src/PVE/ACME/StandAlone.pm   |  4 ++++
 3 files changed, 29 insertions(+)

diff --git a/src/PVE/ACME.pm b/src/PVE/ACME.pm
index 114eb41..a4da8d4 100644
--- a/src/PVE/ACME.pm
+++ b/src/PVE/ACME.pm
@@ -493,6 +493,27 @@ sub request_challenge_validation {
     return $return;
 }
 
+# return all availible subplugins from the plugins
+sub get_subplugins {
+
+    my $tmp = [];
+    my $plugins = PVE::ACME::Challenge->lookup_types();
+
+    foreach my $plugin_name (@$plugins) {
+	my $plugin = PVE::ACME::Challenge->lookup($plugin_name);
+	push @$tmp, $plugin->get_subplugins();
+    }
+
+    my $subplugins = [];
+    foreach my $array (@$tmp) {
+	foreach my $subplugin ( @$array) {
+	    push @$subplugins, $subplugin;
+	}
+    }
+
+    return $subplugins;
+}
+
 # actually 'do' a $method request on $url
 # $data: input for JWS, optional
 # $use_jwk: use JWK instead of KID in JWD (see sub jws)
diff --git a/src/PVE/ACME/DNSChallenge.pm b/src/PVE/ACME/DNSChallenge.pm
index 7af442e..f62333b 100644
--- a/src/PVE/ACME/DNSChallenge.pm
+++ b/src/PVE/ACME/DNSChallenge.pm
@@ -153,6 +153,10 @@ sub extract_challenge {
 
     return PVE::ACME::Challenge->extract_challenge($challenge, 'dns-01');
 }
+    
+sub get_subplugins {
+    return $api_name_list;
+}
 
 # The order of the parameters passed to proxmox-acme is important
 # proxmox-acme setup $plugin [$domain|$alias] $txtvalue $plugin_conf_string
diff --git a/src/PVE/ACME/StandAlone.pm b/src/PVE/ACME/StandAlone.pm
index 73caef6..310e627 100644
--- a/src/PVE/ACME/StandAlone.pm
+++ b/src/PVE/ACME/StandAlone.pm
@@ -33,6 +33,10 @@ sub extract_challenge {
     return PVE::ACME::Challenge->extract_challenge($challenge, 'http-01');
 }
 
+sub get_subplugins {
+    return [];
+}
+
 sub setup {
     my ($class, $data) = @_;
 
-- 
2.20.1





More information about the pve-devel mailing list