Add database setup to migration script.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/66ba6b47 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/66ba6b47 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/66ba6b47 Branch: refs/heads/USERGRID-933 Commit: 66ba6b47702dfd13e472fdc62eb0e97af07afe00 Parents: cf6cf83 Author: Michael Russo <michaelaru...@gmail.com> Authored: Fri Sep 11 12:48:57 2015 -0700 Committer: Michael Russo <michaelaru...@gmail.com> Committed: Fri Sep 11 12:48:57 2015 -0700 ---------------------------------------------------------------------- stack/scripts/migrate_entity_data.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/66ba6b47/stack/scripts/migrate_entity_data.py ---------------------------------------------------------------------- diff --git a/stack/scripts/migrate_entity_data.py b/stack/scripts/migrate_entity_data.py index 66a9dd0..4258a71 100644 --- a/stack/scripts/migrate_entity_data.py +++ b/stack/scripts/migrate_entity_data.py @@ -130,6 +130,8 @@ class Migrate: try: + self.run_database_setup() + # We need to check and roll the migration system to 1 if not already migration_system_updated = self.is_migration_system_updated() @@ -220,6 +222,10 @@ class Migrate: self.log_metrics() self.logger.error('Keyboard interrupted migration. Please run again to ensure the migration finished.') + def get_database_setup_url(self): + url = self.endpoint + '/system/database/setup' + return url + def get_migration_url(self): url = self.endpoint + '/system/migrate/run' return url @@ -255,6 +261,17 @@ class Migrate: self.logger.error('Failed to start migration, %s', e) exit_on_error(str(e)) + def run_database_setup(self): + try: + setupUrl = self.get_database_setup_url() + r = requests.put(url=setupUrl, auth=(self.admin_user, self.admin_pass)) + if r.status_code != 200: + exit_on_error('Database Setup Failed') + + except requests.exceptions.RequestException as e: + self.logger.error('Failed to run database setup, %s', e) + exit_on_error(str(e)) + def start_index_mapping_migration(self): try: migrateUrl = self.get_migration_url() + '/' + PLUGIN_INDEX_MAPPING