public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup v3] fix #4343: updated `view_task_result` to bail on task failure
Date: Wed, 27 Sep 2023 17:32:00 +0200	[thread overview]
Message-ID: <22587f62-09e3-c217-24b3-f641585e7b53@proxmox.com> (raw)
In-Reply-To: <d103eb9a-c472-4528-b95d-f8e1d4012ff6@proxmox.com>


On 9/27/23 16:38, Thomas Lamprecht wrote:
> Am 08/09/2023 um 15:32 schrieb Gabriel Goller:
>> Now we make an additional request on `api2/json/.../tasks/{upid}/status` to
>> get the `exitstatus` of the task. This allows us to `bail` and thus
>> get a non-zero exit code in the cli.
>> index 0bbb928d..709d0d08 100644
>> --- a/pbs-client/src/task_log.rs
>> +++ b/pbs-client/src/task_log.rs
>> @@ -96,6 +96,14 @@ pub async fn display_task_log(
>>               }
>>           }
>>   
>> +        let status_path = format!("api2/json/nodes/localhost/tasks/{upid_encoded}/status");
>> +        let status_result = client.get(&status_path, None).await?;
>> +        if status_result["data"]["status"].as_str() == Some("stopped")
>> +            && status_result["data"]["exitstatus"].as_str() != Some("OK")
>> +        {
>> +            bail!("task failed");
> Hmm, while writing the changelog for a next bump I noticed that this
> will now also exit with a failure-code when there are "only" warnings.
>
> Did you think about that case?
>
> Should we at least exit with different codes? I.e., so that tooling can
> differentiate between error, meaning complete failure, and warnings,
> meaning task probably did its main job, but something (recoverable) was
> off.
>
> IMO one could also argue that it would be sensible to exit with SUCCESS
> (0) even on warnings, as after all warnings should be only returned if
> the main job of the task was still successful, but, e.g., some
> deprecated config option was set or the like.
Yes, submitting a new patch. Now we use exit code 0 (SUCCESS)
on warnings as well.




      reply	other threads:[~2023-09-27 15:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 13:32 Gabriel Goller
2023-09-11  6:56 ` Maximiliano Sandoval
2023-09-11  8:36   ` Gabriel Goller
2023-09-18 14:40 ` [pbs-devel] applied: " Thomas Lamprecht
2023-09-27 14:38 ` [pbs-devel] " Thomas Lamprecht
2023-09-27 15:32   ` Gabriel Goller [this message]

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=22587f62-09e3-c217-24b3-f641585e7b53@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=t.lamprecht@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 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