Imported Debian patch 4.0.5-6~numeezy

This commit is contained in:
Alexandre Ellert
2016-02-17 15:07:45 +01:00
committed by Mario Fetka
parent c44de33144
commit 10dfc9587b
1203 changed files with 53869 additions and 241462 deletions

View File

@@ -24,32 +24,25 @@ from ipapython import sysrestore
from ipaplatform.paths import paths
from ipapython.ipa_log_manager import *
STATEFILE_DIR = paths.STATEFILE_DIR
STATEFILE_FILE = 'sysupgrade.state'
_sstore = None
def _load_sstore():
global _sstore
if _sstore is None:
_sstore = sysrestore.StateFile(paths.STATEFILE_DIR, STATEFILE_FILE)
_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)
def remove_upgrade_file():
try:
os.remove(os.path.join(paths.STATEFILE_DIR, STATEFILE_FILE))
except Exception as e:
os.remove(os.path.join(STATEFILE_DIR, STATEFILE_FILE))
except Exception, e:
root_logger.debug('Cannot remove sysupgrade state file: %s', e)