Using tarfile lib instead of subprocess

Bug #1947733 reported by Martin Kalcok
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EasyRSA Charm
New
Undecided
Unassigned

Bug Description

Easyrsa charm uses subprocess to execute "tar" executable on couple of places in the reactive layer. This can be replaced with usage of a builtin `tarfile` library.

1. In the install() function, subprocess is used to unpack easyrsa tarball resource [1]

2.In the get_version() function subprocess is used to list contents of the easyrsa tarball resource [2]

In addition, the get_version() function could use some sanity checks to ensure that easyrsa tarball (and its contents) have expected structure and naming. As it stands now, the function can raise KeyErrors or report values that are not actually an EasyRSA version.

---
[1] https://github.com/charmed-kubernetes/layer-easyrsa/blob/44f635b92624be5882c70ca1544d79f5d8483e24/reactive/easyrsa.py#L59
[2] https://github.com/charmed-kubernetes/layer-easyrsa/blob/44f635b92624be5882c70ca1544d79f5d8483e24/reactive/easyrsa.py#L463

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.