diff options
author | 2018-07-02 14:50:32 -0700 | |
---|---|---|
committer | 2018-07-06 22:22:11 -0700 | |
commit | dfdfd7ccde868f2069de44bb5c3331482177b88d (patch) | |
tree | f28644f357c78099f7e0dd4514641f3c9b50c167 | |
parent | gkeys/utils.py: Add get_ack function (diff) | |
download | gentoo-keys-dfdfd7ccde868f2069de44bb5c3331482177b88d.tar.gz gentoo-keys-dfdfd7ccde868f2069de44bb5c3331482177b88d.tar.bz2 gentoo-keys-dfdfd7ccde868f2069de44bb5c3331482177b88d.zip |
gkeys/fileops.py: Add new updateseeds function
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
-rw-r--r-- | gkeys/gkeys/fileops.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gkeys/gkeys/fileops.py b/gkeys/gkeys/fileops.py index 5b89ea8..f6341ca 100644 --- a/gkeys/gkeys/fileops.py +++ b/gkeys/gkeys/fileops.py @@ -1,4 +1,6 @@ import os +import shutil + from snakeoil.osutils import (ensure_dirs as snakeoil_ensure_dirs) @@ -61,3 +63,29 @@ def updatefiles(config, logger, category=None, filename = None): raise return False return True + + +def updateseeds(config, logger, src, dst): + if not src or not dst: + logger.error("MAIN: updateseeds(); source and/or destination not supplied") + return False + try: + if os.path.exists(dst): + logger.debug( + "MAIN: updateseeds(); Removing 'old' seed file: %s" + % dst) + os.unlink(dst) + if os.path.exists(src): + logger.debug( + "MAIN: updateseeds(); Moving new seed file to: " + "%s" % dst) + shutil.move(src, dst) + except IOError: + raise + return False + return True + + +def rm_files(config, logger, files, lock=None): + pass + |