stackabletech / agent

Stackable Agent - a kubelet written in Rust which uses systemd as its backend
Apache License 2.0
15 stars 9 forks source link

Added improved error handling around downloading and installing packages #326

Closed soenkeliebau closed 2 years ago

soenkeliebau commented 2 years ago

The agent currently does not delete the target directory for package installations, if the installation fails. This PR adds handling to remove those directories on errors when extracting.

The agent now also specifically requests 'application/gzip' as content type. We encountered issues with a webserver which provided our gzipped packages as 'application/tar' and moved the gzip to 'content_encoding' which caused reqwest to transparrently unpack the zip and the subsequent attempt by the agent to unzip this file to fail.

fixes #324 fixes #325

Description

Review Checklist

siegfriedweber commented 2 years ago

The clean up after a failed installation cannot be tested with an integration test.

The check of the content type could be automatically tested as follows:

  1. The test case creates an ad-hoc repository which returns an invalid content type.
  2. The test case waits until the reason in the pod status is "DownloadingBackoff".
  3. The test case deletes the ad-hoc repository and creates a new one which returns the expected content type.
  4. The test case waits until the pod was started successfully.

The effort implementing this test case is large. Its meaningfulness is limited because the status "DownloadingBackoff" could result from another issue. It is in general a problem to test intermediate results in the Stackable Agent. So I would refrain from implementing it.

I adapted the integration tests to return the expected content type (see stackabletech/agent-integration-tests#89).

@soenkeliebau, @maltesander, @teozkr Are you okay if we merge this request without an integration test case?