From 9d98d1ee6339f1f579f55915c9b507543037ed6c Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 28 Feb 2018 16:19:17 +0100 Subject: [PATCH] disable send2trash by default avoids filling up hidden .Trash directory when files are deleted since there's no UI for trash in a jupyterhub deployment, this mainly results in files never being deleted and possibly filling up disks --- jupyterhub/singleuser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jupyterhub/singleuser.py b/jupyterhub/singleuser.py index ccde7064..b211e97e 100755 --- a/jupyterhub/singleuser.py +++ b/jupyterhub/singleuser.py @@ -340,7 +340,7 @@ class SingleUserNotebookApp(NotebookApp): @gen.coroutine def check_hub_version(self): """Test a connection to my Hub - + - exit if I can't connect at all - check version and warn on sufficient mismatch """ @@ -357,10 +357,16 @@ class SingleUserNotebookApp(NotebookApp): break else: self.exit(1) - + hub_version = resp.headers.get('X-JupyterHub-Version') _check_version(hub_version, __version__, self.log) + def initialize(self, argv=None): + # disable trash by default + # this can be re-enabled by config + self.config.FileContentsManager.delete_to_trash = False + return super().initialize(argv) + def start(self): self.log.info("Starting jupyterhub-singleuser server version %s", __version__) # start by hitting Hub to check version