diff options
author | Holger Mueller <hom@cm4all.com> | 2018-07-05 12:28:33 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-07-08 14:28:49 +0300 |
commit | afd17a32dd130f46cd65b7c036decc485325af87 (patch) | |
tree | 656177eb00b0293a7fa09dc7900bcc3c85bbb942 | |
parent | 79e217300fdba7bd9f4c78d994a743e0a247f47c (diff) | |
download | vmdb2-afd17a32dd130f46cd65b7c036decc485325af87.tar.gz |
Add: run "apt-get clean" after apt step
can be suppressed if user wan't to keep debs in cache.
-rw-r--r-- | vmdb/plugins/apt_plugin.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vmdb/plugins/apt_plugin.py b/vmdb/plugins/apt_plugin.py index 641109e..4f52fe8 100644 --- a/vmdb/plugins/apt_plugin.py +++ b/vmdb/plugins/apt_plugin.py @@ -49,6 +49,9 @@ class AptStepRunner(vmdb.StepRunnerInterface): state.got_eatmydata = True self.install_packages(mount_point, ['eatmydata'], packages) + if step.get('clean', True): + self.clean_cache(mount_point) + def got_eatmydata(self, state): return hasattr(state, 'got_eatmydata') and getattr(state, 'got_eatmydata') @@ -61,3 +64,12 @@ class AptStepRunner(vmdb.StepRunnerInterface): argv_prefix + ['apt-get', '-y', '--no-show-progress', 'install'] + packages, env=env) + + def clean_cache(self, mount_point): + env = os.environ.copy() + env['DEBIAN_FRONTEND'] = 'noninteractive' + + vmdb.runcmd_chroot( + mount_point, + ['apt-get', 'clean'], + env=env) |