Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mfojtik committed Jan 25, 2017
1 parent 85b5b00 commit 40d2a61
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/cmd/admin/image/verify-signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (o *VerifyImageSignatureOptions) Complete(f *clientcmd.Factory, cmd *cobra.
// .gnupg/pubring.gpg will be ignored.
if len(o.PublicKeyFilename) > 0 {
if o.Remove {
return kcmdutil.UsageError(cmd, "cannot use public key when removing verifications status")
return kcmdutil.UsageError(cmd, "cannot use public key when removing verification status")
}
if o.PublicKey, err = ioutil.ReadFile(o.PublicKeyFilename); err != nil {
return err
Expand Down Expand Up @@ -174,10 +174,10 @@ func (o *VerifyImageSignatureOptions) verifyImageIdentity(reference, digest stri
return nil
}

// removeImageSignature removes the current image signature from the Image object by
// clearSignatureVerificationStatus removes the current image signature from the Image object by
// erasing all signature fields that were previously set (when image signature was
// previously verified).
func (o *VerifyImageSignatureOptions) removeImageSignature(s *imageapi.ImageSignature) {
func (o *VerifyImageSignatureOptions) clearSignatureVerificationStatus(s *imageapi.ImageSignature) {
s.Conditions = []imageapi.SignatureCondition{}
s.IssuedBy = nil
}
Expand All @@ -196,7 +196,7 @@ func (o *VerifyImageSignatureOptions) Run() error {
// signatures.
// TODO: This should probably need to handle removal of a single signature.
if o.Remove {
o.removeImageSignature(&img.Signatures[i])
o.clearSignatureVerificationStatus(&img.Signatures[i])
continue
}

Expand All @@ -220,7 +220,7 @@ func (o *VerifyImageSignatureOptions) Run() error {
// If we have error and --confirm then remove the signature from the image which
// changes the image to "unverified" state.
if signatureErr != nil || signatureContentErr != nil || identityError != nil {
o.removeImageSignature(&img.Signatures[i])
o.clearSignatureVerificationStatus(&img.Signatures[i])
continue
}

Expand Down

0 comments on commit 40d2a61

Please sign in to comment.