public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox-acme] plugin-caller: make no-ops always successful
@ 2021-07-16 13:43 Stoiko Ivanov
  2021-07-16 15:59 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2021-07-16 13:43 UTC (permalink / raw)
  To: pve-devel

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@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH proxmox-acme] plugin-caller: make no-ops always successful
  2021-07-16 13:43 [pve-devel] [PATCH proxmox-acme] plugin-caller: make no-ops always successful Stoiko Ivanov
@ 2021-07-16 15:59 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-07-16 15:59 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stoiko Ivanov

On 16.07.21 15:43, Stoiko Ivanov wrote:
> 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@proxmox.com>
> ---
>  src/proxmox-acme | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-16 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 13:43 [pve-devel] [PATCH proxmox-acme] plugin-caller: make no-ops always successful Stoiko Ivanov
2021-07-16 15:59 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal