extra_packages does not work with more than one package

Bug #1863860 reported by Benjamin Allot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Apache2 Charm
Fix Released
Medium
Benjamin Allot

Bug Description

When setting the extra_packages configuration to "irssi screen" I hav the following log

| 2020-02-19 09:03:39 DEBUG config-changed E: Unable to locate package irssi screen

The reason is the way the command is computed. I added some logs to confirm it:

| 020-02-19 09:03:38 INFO juju-log Running ['apt-get', '-y', 'install', '-qq', 'irssi screen']

A quick fix that works (and we could expand to integrate comma as well) is to simply iterate over the string passed to the apt_get_install method.

diff --git a/hooks/hooks.py b/hooks/hooks.py
index b2647f7..bbfd91a 100755
--- a/hooks/hooks.py
+++ b/hooks/hooks.py
@@ -57,7 +57,8 @@ def apt_get_install(package=None):
     if package is None:
         return False
     cmd_line = ['apt-get', '-y', 'install', '-qq']
- cmd_line.append(package)
+ for pkg in package.split(' '):
+ cmd_line.append(pkg)
     return subprocess.call(cmd_line)

Related branches

Benjamin Allot (ballot)
Changed in apache2-charm:
importance: Undecided → Medium
assignee: nobody → Benjamin Allot (ballot)
status: New → Fix Released
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.