all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] tools/subscription: ignore ENOENT for apt auth config removal
Date: Wed, 17 Mar 2021 15:19:18 +0100	[thread overview]
Message-ID: <20210317141918.24843-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210317141918.24843-1-d.csapak@proxmox.com>

deleting a nonexistant file is hardly an error worth mentioning

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/tools/subscription.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/tools/subscription.rs b/src/tools/subscription.rs
index 07c6b40f..9b9534ac 100644
--- a/src/tools/subscription.rs
+++ b/src/tools/subscription.rs
@@ -318,8 +318,11 @@ pub fn update_apt_auth(key: Option<String>, password: Option<String>) -> Result<
             replace_file(auth_conf, conf.as_bytes(), file_opts)
                 .map_err(|e| format_err!("Error saving apt auth config - {}", e))?;
         }
-        _ => nix::unistd::unlink(auth_conf)
-            .map_err(|e| format_err!("Error clearing apt auth config - {}", e))?,
+        _ => match nix::unistd::unlink(auth_conf) {
+            Ok(()) => Ok(()),
+            Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => Ok(()), // ignore not existing
+            Err(err) => Err(err),
+        }.map_err(|e| format_err!("Error clearing apt auth config - {}", e))?,
     }
     Ok(())
 }
-- 
2.20.1





  reply	other threads:[~2021-03-17 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 14:19 [pbs-devel] [PATCH proxmox-backup 1/2] server/email_notifications: do not double html escape Dominik Csapak
2021-03-17 14:19 ` Dominik Csapak [this message]
2021-03-17 19:38   ` [pbs-devel] applied: [PATCH proxmox-backup 2/2] tools/subscription: ignore ENOENT for apt auth config removal Thomas Lamprecht
2021-03-17 19:39 ` [pbs-devel] [PATCH proxmox-backup 1/2] server/email_notifications: do not double html escape Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210317141918.24843-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal