[pve-devel] [PATCH proxmox-acme] plugin-caller: make no-ops always successful

Stoiko Ivanov s.ivanov at proxmox.com
Fri Jul 16 15:43:05 CEST 2021


proxmox-acme is used to call the dns-plugins from acme.sh and has the
config editing (saving/clearing) turned int no-ops.

bash's `return` statement w/o argument returns the value of the last
executed command (the one before our no-op method was called) (see
`help return` in bash).
This leads to unexpected behavior in some plugins, which call one of
the methods as last statement join the next step with `&&`.

tested bash behavior with:
```
foo() { return; }; if [ -z 'x' ]; then :; else foo ; fi; echo $?
```

reported in our community-forum:
https://forum.proxmox.com/threads/pmg-acme-dns-with-cyon-failing-to-issue-certificate.92762

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/proxmox-acme | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/proxmox-acme b/src/proxmox-acme
index 4d249a7..f228a0b 100644
--- a/src/proxmox-acme
+++ b/src/proxmox-acme
@@ -495,7 +495,7 @@ __red() {
 }
 
 _log() {
-    return
+    return 0
 }
 
 _info() {
@@ -526,11 +526,11 @@ _readaccountconf_mutable() {
 
 # no-ops:
 _clearaccountconf() {
-  return
+  return 0
 }
 
 _cleardomainconf() {
-  return
+  return 0
 }
 
 _debug() {
@@ -562,23 +562,23 @@ _secure_debug3() {
 }
 
 _saveaccountconf() {
-  return
+  return 0
 }
 
 _saveaccountconf_mutable() {
-  return
+  return 0
 }
 
 _save_conf() {
-  return
+  return 0
 }
 
 _savedomainconf() {
-  return
+  return 0
 }
 
 _source_plugin_config() {
-  return
+  return 0
 }
 
 # Proxmox implementation to inject the DNSAPI variables
-- 
2.30.2






More information about the pve-devel mailing list