diff --git a/php/EE_CLI/Configurator.php b/php/EE_CLI/Configurator.php index d1a28b23..a4f7b3fa 100644 --- a/php/EE_CLI/Configurator.php +++ b/php/EE_CLI/Configurator.php @@ -169,6 +169,19 @@ class Configurator { } } + /** + * Check if stack exists in YAML file. + * + * @param string $yml_file Path to the YAML file + * @return boolean if stack exists + **/ + public function check_stack_exists($path, $stack){ + if (array_key_exists($stack, self::load_yml( $path ))){ + return true; + } + return false; + } + /** * Load values from a YAML file. * @@ -220,4 +233,5 @@ class Configurator { } } + } diff --git a/php/EE_CLI/Runner.php b/php/EE_CLI/Runner.php index 428ebe1b..e60a4509 100644 --- a/php/EE_CLI/Runner.php +++ b/php/EE_CLI/Runner.php @@ -259,8 +259,9 @@ class Runner { /* Dynamic arguments for stack to be checked before parsing */ - private static function stack_work($args, $assoc_args) + private function stack_work($args, $assoc_args) { + $configurator = \EE_CLI::get_configurator(); print_r($args); print_r($assoc_args); foreach ( $assoc_args as $key => $value) { @@ -268,7 +269,12 @@ class Runner { if ($args[1] === 'install'){ // check if key matches any stack config // otherwise throw error if not exists - unset( $assoc_args[ $key ] ); + if($configurator->check_stack_exists($this->global_config_path, $key)){ + unset( $assoc_args[ $key ] ); + } + else { + print("Error:"); + } } } }