-
Notifications
You must be signed in to change notification settings - Fork 237
move image verification logic into preppers. replace string->prep map… #94
Conversation
func (p CloudPrepper) SupportsImage() bool { | ||
pattern := regexp.MustCompile("^.+/.+(:.+){0,1}$") | ||
image := p.ImagePrepper.Source | ||
if exp := pattern.FindString(image); exp != image || CheckTar(image) { |
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.
Hmm, why does this support tars?
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.
it won't. keeping the functional changes to a minimum in this PR, I fixed this in #89
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.
Ah I see, yeah this worked that way before
@@ -33,7 +33,7 @@ var analyzeCmd = &cobra.Command{ | |||
Short: "Analyzes an image: [image]", | |||
Long: `Analyzes an image using the specifed analyzers as indicated via flags (see documentation for available ones).`, | |||
Args: func(cmd *cobra.Command, args []string) error { | |||
if err := validateArgs(args, checkAnalyzeArgNum, checkArgType); err != nil { | |||
if err := validateArgs(args, checkAnalyzeArgNum); err != nil { |
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.
Now that we don't validate strings up front, how long does it take to fail if we pass an invalid argument?
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.
marginal amount of time more, if any. the validation happens before any processing happens
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.
Would you mind attaching the output of an error case to the PR?
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.
whoops didn't see this, let me generate one
func (p CloudPrepper) SupportsImage() bool { | ||
pattern := regexp.MustCompile("^.+/.+(:.+){0,1}$") | ||
image := p.ImagePrepper.Source | ||
if exp := pattern.FindString(image); exp != image || CheckTar(image) { |
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.
Ah I see, yeah this worked that way before
… with array
cc @dlorenc