(or maybe this interacts /really/ poorly with restore, in which case
restore should ensure all files are present before actually doing the
restore)
-- Should be able to run restore from /tmp directory
- Show progress or something when upgrading
- Allow 'sticky notes' for future upgraders to notice
- Blacklist should allow an easy way for a user to override it,
Functions
---------
+.. autofunction:: chdir_to_production
.. autofunction:: dictmap
.. autofunction:: dictkmap
.. autofunction:: chdir
dir = os.path.abspath(args[0]) if args else os.getcwd()
shell.drop_priviledges(dir, options.log_file)
util.chdir(dir)
+ util.chdir_to_production()
d = deploy.ProductionCopy(".")
d.verify()
d.verifyConfigured()
# Directory information not transferred via command line, so this
# will not error due to the changed directory.
shell.drop_priviledges(".", options.log_file)
- # XXX: this should be abstracted away!
- if os.path.exists(".git/WIZARD_REPO"):
- util.chdir(shell.eval('git', 'config', 'remote.origin.url'))
+ util.chdir_to_production()
production = deploy.ProductionCopy(".")
production.verify()
open(production.blacklisted_file, 'w').write(reason + "\n")
import os
import sys
-from wizard import command, deploy, shell
+from wizard import command, deploy, shell, util
def main(argv, baton):
options, args = parse_args(argv, baton)
+ util.chdir_to_production()
d = deploy.ProductionCopy(".")
d.verify()
backups = d.backup_dir
If we called ``--continue`` inside a production copy, check if
:file:`.wizard/pending` exists and change to that directory if so.
"""
- # XXX: Can't use deploy; maybe should stringify constants?
- if os.path.exists(".wizard/pending"):
- newdir = open(".wizard/pending").read().strip()
- logging.warning("Detected production copy; changing directory to %s", newdir)
- os.chdir(newdir)
+ util.chdir_to_production()
def resumeState(self):
self.temp_wc_dir = os.getcwd()
self.wc = deploy.WorkingCopy(".")
return False
return bool(val)
+def chdir_to_production():
+ # XXX: Can't use deploy; maybe should stringify constant
+ # .wizard/pending?
+ if os.path.exists(".wizard/pending"):
+ newdir = open(".wizard/pending").read().strip()
+ logging.warning("Detected production copy; changing directory to %s", newdir)
+ os.chdir(newdir)
+
class ChangeDirectory(object):
"""
Context for temporarily changing the working directory.