From baa665fe4043615f3e5a653e6894ce7457855d87 Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Wed, 19 Mar 2014 12:56:03 +0100 Subject: Load sysupgrade.state on demand. This prevents SELinux denials when the sysupgrade module is imported in a confined process. Reviewed-By: Rob Crittenden --- ipaserver/install/sysupgrade.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ipaserver/install/sysupgrade.py') diff --git a/ipaserver/install/sysupgrade.py b/ipaserver/install/sysupgrade.py index d11d0a979..4ce652ca1 100644 --- a/ipaserver/install/sysupgrade.py +++ b/ipaserver/install/sysupgrade.py @@ -27,17 +27,25 @@ from ipapython.ipa_log_manager import * STATEFILE_DIR = paths.STATEFILE_DIR STATEFILE_FILE = 'sysupgrade.state' -_sstore = sysrestore.StateFile(STATEFILE_DIR, STATEFILE_FILE) +_sstore = None + +def _load_sstore(): + global _sstore + if _sstore is None: + _sstore = sysrestore.StateFile(STATEFILE_DIR, STATEFILE_FILE) def get_upgrade_state(module, state): + _load_sstore() global _sstore return _sstore.get_state(module, state) def set_upgrade_state(module, state, value): + _load_sstore() global _sstore _sstore.backup_state(module, state, value) def remove_upgrade_state(module, state): + _load_sstore() global _sstore _sstore.delete_state(module, state) -- cgit