From 97ccdacb188cfd1da303a858455ea6787cf1dc62 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 20 Apr 2018 10:38:33 -0700 Subject: [PATCH] import: Fix ordering of subdomain availability check. When you're importing with --destroy-rebuild-database, we need to check subdomain availability after we've cleared out the database; otherwise, trying to reuse the same subdomain doesn't work. --- zerver/management/commands/import.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zerver/management/commands/import.py b/zerver/management/commands/import.py index af45a3dd6d..45c524c03a 100644 --- a/zerver/management/commands/import.py +++ b/zerver/management/commands/import.py @@ -65,7 +65,6 @@ import a database dump from one or more JSON files.""" if subdomain is None: print("Enter subdomain!") exit(1) - check_subdomain_available(subdomain) if options["destroy_rebuild_database"]: print("Rebuilding the database!") @@ -75,6 +74,8 @@ import a database dump from one or more JSON files.""" for model in models_to_import: self.new_instance_check(model) + check_subdomain_available(subdomain) + for path in options['export_files']: if not os.path.exists(path): print("Directory not found: '%s'" % (path,))