ctx.download_resource creates directories needlessly

Description

When target_path is None, the download_resource function is expected to download the resource into a temporary file.

What it actually ends up doing, is downloading the resource into a temporary file located in a brand new temporary directory:

https://github.com/cloudify-cosmo/cloudify-plugins-common/blob/4.2/cloudify/manager.py#L156

The results:

  • Way too many directories created for no reason

  • In order to do proper cleanup, the caller needs to know that they should delete the temporary file's directory, and not just the temporary file itself

Activity

Show:
Isaac Shabtay
December 5, 2017, 9:28 PM

(Leaving this issue here rather than deleting it, so others who may wonder about this will find the explanation)

When target_path is None, we download the resource by preserving its basename. That requires us to download into a new directory each time.

Overall the best approach is to always provide target_path, and then delete the resource after usage.

Assignee

Isaac Shabtay

Reporter

Isaac Shabtay

Labels

None

Bug Type

None

Target Version

None

Severity

None

Fix versions

Affects versions

Configure