self.prod = deploy.ProductionCopy(".")
self.prod.verify()
self.repo = self.prod.application.repository(options.srv_path)
+ util.assert_all_writable()
# XXX: put this in Application
self.version = shell.eval("git", "--git-dir="+self.repo, "describe", "--tags", "master")
self.preflightBlacklist()
f.close() # just to be safe
return ret
+def assert_all_writable(dir="."):
+ """Recursively checks if all files and directories in a directory are
+ writable. Raises :exc:`PermissionsError` if this is not true."""
+ for dirpath, dirname, filenames in os.walk(dir):
+ if not os.access(dirpath, os.W_OK):
+ raise PermissionsError
+ for filename in filenames:
+ if not os.access(os.path.join(dirpath, filename), os.W_OK):
+ raise PermissionsError
+
class NoOperatorInfo(wizard.Error):
"""No information could be found about the operator from Kerberos."""
pass