summaryrefslogtreecommitdiff
blob: 9c542cfc07779c25094b5ca637b2028a395c1902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 7868b97507d0dd7d7721ad5c4539e22c67635f92 Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <eva@gentoo.org>
Date: Wed, 14 Nov 2018 15:58:30 +0100
Subject: [PATCH 5/5] gentoo: add support for package_upgrade

---
 cloudinit/distros/gentoo.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/cloudinit/distros/gentoo.py b/cloudinit/distros/gentoo.py
index 7b838e82..22ad2cf3 100644
--- a/cloudinit/distros/gentoo.py
+++ b/cloudinit/distros/gentoo.py
@@ -189,23 +189,26 @@ class Distro(distros.Distro):
         distros.set_etc_timezone(tz=tz, tz_file=self._find_tz_file(tz))
 
     def package_command(self, command, args=None, pkgs=None):
-        if pkgs is None:
-            pkgs = []
-
         cmd = ['emerge']
         # Redirect output
         cmd.append("--quiet")
 
-        if args and isinstance(args, str):
-            cmd.append(args)
-        elif args and isinstance(args, list):
-            cmd.extend(args)
+        if command == "upgrade":
+            cmd.extend(["--update", "world"])
+        else:
+            if pkgs is None:
+                pkgs = []
+
+            if args and isinstance(args, str):
+                cmd.append(args)
+            elif args and isinstance(args, list):
+                cmd.extend(args)
 
-        if command:
-            cmd.append(command)
+            if command:
+                cmd.append(command)
 
-        pkglist = util.expand_package_list('%s-%s', pkgs)
-        cmd.extend(pkglist)
+            pkglist = util.expand_package_list('%s-%s', pkgs)
+            cmd.extend(pkglist)
 
         # Allow the output of this to flow outwards (ie not be captured)
         util.subp(cmd, capture=False)
-- 
2.19.1