Commit a7925db0 authored by Mark Harding's avatar Mark Harding
Browse files

Merge branch 'installer-fixes' into 'master'

(fix) Not swallowing errors and mysteriously exploding

See merge request !227
parents 2ff92bc0 2b3da022
Loading
Loading
Loading
Loading
+7 −22
Original line number Original line Diff line number Diff line
@@ -71,34 +71,19 @@ class Install extends Cli\Controller implements Interfaces\CliControllerInterfac
                    $provisioner->reloadStorage();
                    $provisioner->reloadStorage();
                    $this->out('OK');
                    $this->out('OK');
                }
                }
            } catch (Exception $e) {
            } catch (Exception $ex) {
                // REVNOTE: This seems unused, currently. None of the database provisioners currently
                $this->out('Something BAD happened while provisioning Cassandra' . $ex->getMessage()); 
                // throw ProvisionException. We should maybe catch general exceptions (log them) and continue,
                // and not ProvisionExceptions. I considered removing this altogether, but it is useful to continue
                // past server errors in an setup.
                if ($this->getOpt('graceful-storage-provision')) {
                    $this->out($e->getMessage());
                    $this->out('Error in cassandra setup. Continuing.');
                } else {
                    throw $e;
                }
            }
            }


            try {
            try {
                if ($installType == "all" || $installType == "cockroach") {
                if ($installType == "all" || $installType == "cockroach") {
                    $this->out('- Provisioning Cockroach:', $this::OUTPUT_INLINE);
                    $this->out('- Provisioning Cockroach:');
                    $isCleanCockroach = $this->getopt("cleanCockroach") != null;
                    $isCleanCockroach = $this->getopt("cleanCockroach") != null;
                    $provisioner->provisionCockroach(null, $isCleanCockroach);
                    $provisioner->provisionCockroach(null, $isCleanCockroach);
                    $this->out('OK');
                    $this->out('OK');
                }
                }
            } catch (Exception $e) {
            } catch (Exception $ex) {
                // See REVNOTE above.
                $this->out('Something BAD happened while provisioning Cockroach' . $ex->getMessage()); 
                if ($this->getOpt('graceful-storage-provision')) {
                    $this->out($e->getMessage());
                    $this->out('Error in cockroach setup. Continuing.');
                } else {
                    throw $e;
                }
            } 
            } 


            if (($installType == "all") || ($installType == "site")) {
            if (($installType == "all") || ($installType == "site")) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -38,7 +38,7 @@ class CassandraProvisioner implements ProvisionerInterface
                $client->execute($statement);
                $client->execute($statement);
            }
            }
        } catch (\Exception $e) {
        } catch (\Exception $e) {
            var_dump($e); exit;
            error_log("Error provisioning cassandra: " . $e->getMessage());
        }
        }
 
 
        return true;
        return true;
+6 −2
Original line number Original line Diff line number Diff line
@@ -41,8 +41,12 @@ class CockroachProvisioner implements ProvisionerInterface
            if (trim($query) === '') {
            if (trim($query) === '') {
                continue;
                continue;
            }
            }
            try {
                $statement = $adminDb->prepare($query);
                $statement = $adminDb->prepare($query);
                $statement->execute();
                $statement->execute();
            } catch (\Exception $ex) {
                error_log("Error running cockroach statement: " . $ex->getMessage());
            }
        }
        }
    }
    }
}
}