From d0ca21cfd6150a78045e025c2994b4c8dcd7bec4 Mon Sep 17 00:00:00 2001 From: Andrew Garner Date: Mon, 20 Mar 2017 22:05:24 +0000 Subject: [PATCH] Delay bootstrapping until sandbox.sh has been generated This pushes the bootstrapping process until after sandbox.sh is rendered. This allows recovering from a failed bootstrap process more easily. This might happen when testing against a newer version of MySQL that the sandbox command doesn't support yet, or if the particular datasource used is incompatible with the distribution of MySQL chosen, among other possible issues. --- dbsake/core/mysql/sandbox/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dbsake/core/mysql/sandbox/__init__.py b/dbsake/core/mysql/sandbox/__init__.py index b73d165..8444302 100644 --- a/dbsake/core/mysql/sandbox/__init__.py +++ b/dbsake/core/mysql/sandbox/__init__.py @@ -55,8 +55,10 @@ def create(**options): # And generating defaults cannot be done until we have an # innodb-log-file-size datasource.preload(sbopts) + info(" Deploying MySQL distribution") dist = distribution.deploy(sbopts) + info(" Generating my.sandbox.cnf") common.generate_defaults(sbopts, mysql_user=sbopts.mysql_user, @@ -69,8 +71,7 @@ def create(**options): tmpdir=os.path.join(sbdir, 'tmp'), mysql_version=dist.version, port=dist.version.as_int()) - info(" Bootstrapping sandbox instance") - common.bootstrap(sbopts, dist) + info(" Creating sandbox.sh initscript") common.generate_initscript(sbdir, distribution=dist, @@ -78,6 +79,9 @@ def create(**options): defaults_file=os.path.join(sbdir, 'my.sandbox.cnf')) + info(" Bootstrapping sandbox instance") + common.bootstrap(sbopts, dist) + info(" Initializing database user") common.initialize_mysql_user(sbopts)