Skip to content
Browse files

Back up the Accounting DB only if it exists

This prevents a failure when running the import script over a clean
installation where the Accounting DB does not exist yet.
  • Loading branch information...
1 parent c253e7c commit 29f80b0c371e8d00272800b3099624a98320ee98 @priteau priteau committed Oct 2, 2012
Showing with 6 additions and 9 deletions.
  1. +6 −9 home/libexec/nimbusconfigure.py
View
15 home/libexec/nimbusconfigure.py
@@ -652,15 +652,12 @@ def copy_accounting_db(setup, old_db_path):
# The one we're about to replace
new_db_path = os.path.join(setup.gtdir, 'var/nimbus/WorkspaceAccountingDB')
- if not os.path.isdir(new_db_path):
- raise IncompatibleEnvironment("Could not find current Accounting DB: %s"
- % new_db_path)
-
- # back this up, just in case this script is used in an odd way
- backup_db_path = os.path.join(setup.gtdir, 'var/nimbus/.prev-accountingDB')
- print "\nBacking up accounting DB to: %s ... " % backup_db_path
- shutil.move(new_db_path, backup_db_path)
- print " - Done."
+ if os.path.isdir(new_db_path):
+ # back this up, just in case this script is used in an odd way
+ backup_db_path = os.path.join(setup.gtdir, 'var/nimbus/.prev-accountingDB')
+ print "\nBacking up accounting DB to: %s ... " % backup_db_path
+ shutil.move(new_db_path, backup_db_path)
+ print " - Done."
print "\nImporting accounting DB to: %s ... " % new_db_path
shutil.copytree(old_db_path, new_db_path)

0 comments on commit 29f80b0

Please sign in to comment.
Something went wrong with that request. Please try again.