Skip to content

Commit

Permalink
print info to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
elchead committed Sep 29, 2023
1 parent 0a5bfe2 commit 195acc2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cli/internal/cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func NewVerifyCmd() *cobra.Command {
}
cmd.Flags().String("cluster-id", "", "expected cluster identifier")
cmd.Flags().Bool("raw", false, "print raw attestation document")
cmd.Flags().String("output", "", "print the attestation document in the output format {json}")
cmd.Flags().StringP("output", "o", "", "print the attestation document in the output format {json}")
cmd.Flags().StringP("node-endpoint", "e", "", "endpoint of the node to verify, passed as HOST[:PORT]")
return cmd
}
Expand Down Expand Up @@ -155,7 +155,7 @@ func (c *verifyCmd) verify(cmd *cobra.Command, fileHandler file.Handler, verifyC
return fmt.Errorf("printing attestation document: %w", err)
}
cmd.Println(attDocOutput)
cmd.Println("Verification OK")
cmd.PrintErrln("Verification OK")

return nil
}
Expand Down Expand Up @@ -217,11 +217,11 @@ func (c *verifyCmd) parseVerifyFlags(cmd *cobra.Command, fileHandler file.Handle
if emptyEndpoint || emptyIDs {
c.log.Debugf("Trying to supplement empty flag values from %q", pf.PrefixPrintablePath(constants.ClusterIDsFilename))
if emptyEndpoint {
cmd.Printf("Using endpoint from %q. Specify --node-endpoint to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename))
cmd.PrintErrf("Using endpoint from %q. Specify --node-endpoint to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename))
endpoint = idFile.IP
}
if emptyIDs {
cmd.Printf("Using ID from %q. Specify --cluster-id to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename))
cmd.PrintErrf("Using ID from %q. Specify --cluster-id to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename))
ownerID = idFile.OwnerID
clusterID = idFile.ClusterID
}
Expand Down
3 changes: 1 addition & 2 deletions cli/internal/cmd/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ func TestVerify(t *testing.T) {
cmd.Flags().String("workspace", "", "") // register persistent flag manually
cmd.Flags().Bool("force", true, "") // register persistent flag manually
out := &bytes.Buffer{}
cmd.SetOut(out)
cmd.SetErr(&bytes.Buffer{})
cmd.SetErr(out)
if tc.clusterIDFlag != "" {
require.NoError(cmd.Flags().Set("cluster-id", tc.clusterIDFlag))
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ constellation verify [flags]
```
--cluster-id string expected cluster identifier
-h, --help help for verify
--json print the attestation document as parsed json
-e, --node-endpoint string endpoint of the node to verify, passed as HOST[:PORT]
-o, --output string print the attestation document in the output format {json}
--raw print raw attestation document
```

Expand Down
19 changes: 10 additions & 9 deletions internal/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ type Certificate struct {

// TCBVersion contains the TCB version data.
type TCBVersion struct {
Bootloader uint8
TEE uint8
SNP uint8
Microcode uint8
Spl4 uint8
Spl5 uint8
Spl6 uint8
Spl7 uint8
UcodeSpl uint8 // UcodeSpl is the microcode security patch level.
Bootloader uint8 `json:"bootloader"`
TEE uint8 `json:"tee"`
SNP uint8 `json:"snp"`
Microcode uint8 `json:"microcode"`
Spl4 uint8 `json:"spl4"`
Spl5 uint8 `json:"spl5"`
Spl6 uint8 `json:"spl6"`
Spl7 uint8 `json:"spl7"`
// UcodeSpl is the microcode security patch level.
UcodeSpl uint8 `json:"ucode_spl"`
}

// PlatformInfo contains the platform information.
Expand Down

0 comments on commit 195acc2

Please sign in to comment.