summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vmdb/plugins/apt_plugin.py12
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)