-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate command checks for missing parameter values #323
Conversation
failed!(message) | ||
end | ||
pv = ParameterValidator.new(stack: @proposed_stack, stack_definition: @stack_definition) | ||
failed!(pv.error_message) if pv.missing_parameters? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract this functionality to the new ParameterValidator
class.
|
||
def missing_parameters? | ||
missing_parameters.any? | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract this functionality to the new ParameterValidator
class.
StackMaster.stdout.print "#{@stack_definition.stack_name}: " | ||
template_body = TemplateCompiler.compile(@config, @stack_definition.compiler, @stack_definition.template_dir, @stack_definition.template, compile_time_parameters, @stack_definition.compiler_options) | ||
cf.validate_template(template_body: TemplateUtils.maybe_compressed_template_body(template_body)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This template compilation logic is duplicated in the Stack
class. It all seems to work by just using the Stack
class directly via the refactoring in 6af37cb, and it keeps things DRY.
if parameter_validator.missing_parameters? | ||
StackMaster.stdout.puts "invalid\n#{parameter_validator.error_message}" | ||
return false | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate that all the parameters are provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
An implementation of the improvement suggested in #189.
There is some custom code in the
apply
command that checks for parameters with no values. If blank parameters are found, it aborts the process and prints a friendly message.In this proposal, the code has been extracted to a separate class,
ParameterValidator
and thevalidate
command modified to use this check. It prints out the same helpful message if it finds this issue.