summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-server-install
diff options
context:
space:
mode:
authorGabe <redhatrises@gmail.com>2014-10-03 17:27:57 -0600
committerPetr Viktorin <pviktori@dhcp-31-13.brq.redhat.com>2014-11-04 12:57:01 +0100
commit7eca640ffa3e661140843d91dc4a846d3355a242 (patch)
treef4c76b3f16e07d0efd83c9a332d7f7fbb8697744 /install/tools/ipa-server-install
parent42724a4b22f9c7025254c875e9f8fcba17f8b9bf (diff)
downloadfreeipa-7eca640ffa3e661140843d91dc4a846d3355a242.tar.gz
freeipa-7eca640ffa3e661140843d91dc4a846d3355a242.tar.xz
freeipa-7eca640ffa3e661140843d91dc4a846d3355a242.zip
Remove trivial path constants from modules
https://fedorahosted.org/freeipa/ticket/4399 Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'install/tools/ipa-server-install')
-rwxr-xr-xinstall/tools/ipa-server-install22
1 files changed, 10 insertions, 12 deletions
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 70ef38610..2c3a28b52 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -415,31 +415,29 @@ def signal_handler(signum, frame):
dsinstance.erase_ds_instance_data (ds.serverid)
sys.exit(1)
-ANSWER_CACHE = paths.ROOT_IPA_CACHE
-
def read_cache(dm_password):
"""
Returns a dict of cached answers or empty dict if no cache file exists.
"""
- if not ipautil.file_exists(ANSWER_CACHE):
+ if not ipautil.file_exists(paths.ROOT_IPA_CACHE):
return {}
top_dir = tempfile.mkdtemp("ipa")
fname = "%s/cache" % top_dir
try:
- decrypt_file(ANSWER_CACHE, fname, dm_password, top_dir)
+ decrypt_file(paths.ROOT_IPA_CACHE, fname, dm_password, top_dir)
except Exception, e:
shutil.rmtree(top_dir)
- raise Exception("Decryption of answer cache in %s failed, please check your password." % ANSWER_CACHE)
+ raise Exception("Decryption of answer cache in %s failed, please check your password." % paths.ROOT_IPA_CACHE)
try:
with open(fname, 'rb') as f:
try:
optdict = pickle.load(f)
except Exception, e:
- raise Exception("Parse error in %s: %s" % (ANSWER_CACHE, str(e)))
+ raise Exception("Parse error in %s: %s" % (paths.ROOT_IPA_CACHE, str(e)))
except IOError, e:
- raise Exception("Read error in %s: %s" % (ANSWER_CACHE, str(e)))
+ raise Exception("Read error in %s: %s" % (paths.ROOT_IPA_CACHE, str(e)))
finally:
shutil.rmtree(top_dir)
@@ -460,7 +458,7 @@ def write_cache(options):
try:
with open(fname, 'wb') as f:
pickle.dump(options, f)
- ipautil.encrypt_file(fname, ANSWER_CACHE, options['dm_password'], top_dir)
+ ipautil.encrypt_file(fname, paths.ROOT_IPA_CACHE, options['dm_password'], top_dir)
except IOError, e:
raise Exception("Unable to cache command-line options %s" % str(e))
finally:
@@ -605,7 +603,7 @@ def uninstall():
tasks.restore_network_configuration(fstore, sstore)
fstore.restore_all_files()
try:
- os.remove(ANSWER_CACHE)
+ os.remove(paths.ROOT_IPA_CACHE)
except Exception:
pass
try:
@@ -818,7 +816,7 @@ def main():
sys.exit(1)
# This will override any settings passed in on the cmdline
- if ipautil.file_exists(ANSWER_CACHE):
+ if ipautil.file_exists(paths.ROOT_IPA_CACHE):
if options.dm_password is not None:
dm_password = options.dm_password
else:
@@ -1401,8 +1399,8 @@ def main():
print "In order for Firefox autoconfiguration to work you will need to"
print "use a SSL signing certificate. See the IPA documentation for more details."
- if ipautil.file_exists(ANSWER_CACHE):
- os.remove(ANSWER_CACHE)
+ if ipautil.file_exists(paths.ROOT_IPA_CACHE):
+ os.remove(paths.ROOT_IPA_CACHE)
return 0
if __name__ == '__main__':