summaryrefslogtreecommitdiffstats
path: root/base/common/python/pki/util.py
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2013-10-28 17:21:59 -0400
committerEndi S. Dewata <edewata@redhat.com>2013-10-31 18:04:14 -0400
commit86ef9b64cb0d71ace679881eacd2f6503afd954d (patch)
tree928d48d186bacf47e0049b81b4a1c2374973f5e7 /base/common/python/pki/util.py
parentaa52cb632be5f64c8859ac636937f0c526b1f10d (diff)
downloadpki-86ef9b64cb0d71ace679881eacd2f6503afd954d.tar.gz
pki-86ef9b64cb0d71ace679881eacd2f6503afd954d.tar.xz
pki-86ef9b64cb0d71ace679881eacd2f6503afd954d.zip
Backup upgrade tracker.
The upgrade framework has been modified to backup the files used to track the upgrade progress. If the tracker file is also modified by the upgrade scriptlet, it will only keep the initial backup (before any modifications were made). Ticket #763
Diffstat (limited to 'base/common/python/pki/util.py')
-rw-r--r--base/common/python/pki/util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/base/common/python/pki/util.py b/base/common/python/pki/util.py
index 4d25390a6..62aec2c47 100644
--- a/base/common/python/pki/util.py
+++ b/base/common/python/pki/util.py
@@ -53,11 +53,15 @@ def copy(source, dest):
targetfile = os.path.join(destpath, filename)
copyfile(sourcefile, targetfile)
-def copyfile(source, dest):
+def copyfile(source, dest, overwrite=True):
"""
Copy a file or link while preserving its attributes.
"""
+ # if dest already exists and not overwriting, do nothing
+ if os.path.exists(dest) and not overwrite:
+ return
+
if os.path.islink(source):
target = os.readlink(source)
os.symlink(target, dest)