Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

move image verification logic into preppers. replace string->prep map… #94

Merged
merged 1 commit into from
Sep 20, 2017

Conversation

nkubala
Copy link
Contributor

@nkubala nkubala commented Sep 19, 2017

… with array

cc @dlorenc

func (p CloudPrepper) SupportsImage() bool {
pattern := regexp.MustCompile("^.+/.+(:.+){0,1}$")
image := p.ImagePrepper.Source
if exp := pattern.FindString(image); exp != image || CheckTar(image) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

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) {
Copy link
Contributor

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

@nkubala nkubala merged commit 6740c50 into GoogleContainerTools:master Sep 20, 2017
@nkubala nkubala deleted the remove_prep_map branch September 20, 2017 00:03
@nkubala
Copy link
Contributor Author

nkubala commented Sep 20, 2017

error.txt

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants