From f92cfcdfc943cfc01d1dca255cecd70723c4b1f1 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Tue, 30 Aug 2016 11:49:39 -0300 Subject: [bug] don't remove combined_bundle file on destructor After PR #116, it's possible to inject an existing combined_ca_bundle to the keymanager initialisation. However, it won't work for multiple users because the file is removed when the keymanager is destroyed. Considering there's no sensitive data on the file and it's created as a temp file, we don't need to handle its deletion. --- src/leap/keymanager/__init__.py | 13 ------------- tests/test_keymanager.py | 4 ---- 2 files changed, 17 deletions(-) diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py index ac9f8eb..2a5bac4 100644 --- a/src/leap/keymanager/__init__.py +++ b/src/leap/keymanager/__init__.py @@ -130,19 +130,6 @@ class KeyManager(object): self._nicknym = Nicknym(self._nickserver_uri, self._ca_cert_path, self._token) self.refresher = None - # - # destructor - # - - def __del__(self): - try: - created_tmp_combined_ca_bundle = self._combined_ca_bundle not in \ - [ca_bundle.where(), self._ca_cert_path] - if created_tmp_combined_ca_bundle: - os.remove(self._combined_ca_bundle) - except OSError: - pass - # # utilities # diff --git a/tests/test_keymanager.py b/tests/test_keymanager.py index 118cd8c..ae06372 100644 --- a/tests/test_keymanager.py +++ b/tests/test_keymanager.py @@ -20,7 +20,6 @@ Tests for the Key Manager. """ -from os import path import json import urllib from datetime import datetime @@ -496,9 +495,6 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): expected = self._slurp_file(ca_bundle.where()) + ca_content self.assertEqual(expected, self._slurp_file(tmp_output.name)) - del km # force km out of scope - self.assertFalse(path.exists(tmp_output.name)) - def _dump_to_file(self, filename, content): with open(filename, 'w') as out: out.write(content) -- cgit v1.2.3