Commit 18f750b5 authored by Jon Pugh's avatar Jon Pugh

Propogate Config Exceptions up to the CLI script provision.php so we get easy to read errors.

parent bdf482c4
......@@ -53,5 +53,10 @@ if ($debug){
);
}
$application = new Application();
$application->run();
try {
$application = new Application();
$application->run();
}
catch (\Exception $e) {
$io->error("Unable to run provision: " . $e->getMessage());
}
......@@ -57,7 +57,12 @@ class Application extends BaseApplication
}
// Load Configs
$this->config = new Config();
try {
$this->config = new Config();
}
catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
parent::__construct($this::NAME, $this::VERSION);
}
......
......@@ -72,18 +72,18 @@ class Config implements ConfigurationInterface
// @TODO: Create some kind of Setup functionality.
if (!is_writable($this->config['aegir_root'])) {
throw new \Exception(
"There is an error with your configuration: The folder set to 'aegir_root' ({$this->config['aegir_root']}) is not writable. Check your ~/.provision.yml file and try again."
"There is an error with your configuration. The folder set to 'aegir_root' ({$this->config['aegir_root']}) is not writable. Fix this or change the aegir_root value in the file {$this->config_path}."
);
}
// Check that config_path exists and is writable.
if (!file_exists($this->config['config_path'])) {
throw new \Exception(
"There is an error with your configuration: The folder set to 'config_path'({$this->config['config_path']}) does not exist. Check your ~/.provision.yml file and try again."
"There is an error with your configuration. The folder set to 'config_path' ({$this->config['config_path']}) does not exist. Create it or change the config_path value in the file {$this->config_path}."
);
}
elseif (!is_writable($this->config['config_path'])) {
throw new \Exception(
"There is an error with your configuration: The folder set to 'config_path'({$this->config['config_path']}) is not writable."
"There is an error with your configuration. The folder set to 'config_path' ({$this->config['config_path']}) is not writable. Fix this or change the config_path value in the file {$this->config_path}."
);
}
......@@ -91,7 +91,7 @@ class Config implements ConfigurationInterface
$real_script_user = $this->getScriptUser();
if ($this->config['script_user'] != $real_script_user) {
throw new \Exception(
"There is an error with your configuration: The user set in 'script_user'({$this->config['script_user']}) is not the currently running user ({$real_script_user})."
"There is an error with your configuration. The user set as 'script_user' ({$this->config['script_user']}) is not the currently running user ({$real_script_user}). Change to user {$this->config['script_user']} or change the script_user value in the file {$this->config_path}."
);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment