Skip to content

Format byte array error output from google_nvme_id as string #1761

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

Merged

Conversation

pwschuurman
Copy link
Contributor

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Error message is currently being printed out as a byte array (%v). It should be printed out as a string (%s). This is done elsewhere exec.CombinedOutput() is parsed.

Current error message is formatted like:

couldn't get serial number for disk pvc-b161d218-87e9-4657-9339-a11ef1eb7a54 at device path /dev/nvme1n2: google_nvme_id failed for device "/dev/nvme1n2" with output [91 50 48 50 52 45 48 54 45 50 48 84 49 57 58 50 52 58 52 48 43 48 48 48 48 93 58 32 80 97 115 115 101 100 32 100 101 118 105 99 101 32 119 97 115 32 110 111 116 32 97 110 32 78 86 77 101 32 100 101 118 105 99 101 46 32 32 40 89 111 117 32 109 97 121 32 110 101 101 100 32 116 111 32 114 117 110 32 116 104 105 115 32 115 99 114 105 112 116 32 97 115 32 114 111 111 116 47 119 105 116 104 32 115 117 100 111 41 46 10]: exit status 1

This should be:

couldn't get serial number for disk pvc-b161d218-87e9-4657-9339-a11ef1eb7a54 at device path /dev/nvme1n2: google_nvme_id failed for device "/dev/nvme1n2" with output [2024-06-22T07:26:12+0000]: Passed device was not an NVMe device.  (You may need to run this script as root/with sudo).: exit status 1

Special notes for your reviewer:
This was discovered when debugging the issue for #1760

Does this PR introduce a user-facing change?:

Improve error message when `google_nvme_id` returns a non-zero exit code

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 25, 2024
@pwschuurman
Copy link
Contributor Author

/assign @Sneha-at

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 25, 2024
@pwschuurman
Copy link
Contributor Author

pwschuurman commented Jun 25, 2024

Failure: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_gcp-compute-persistent-disk-csi-driver/1761/pull-gcp-compute-persistent-disk-csi-driver-e2e/1805435946347270144

Failed with:

�[38;5;243m/home/prow/go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/e2e/tests/single_zone_e2e_test.go:715�[0m

  �[38;5;9m[FAILED] CreateVolume failed with error: rpc error: code = InvalidArgument desc = CreateVolume failed: rpc error: code = InvalidArgument desc = CreateVolume failed to create single zonal disk gcepd-csi-e2e-2ee8c344-aab9-42c0-8ba2-6aaffc3d24ab: failed to insert zonal disk: unknown Insert disk error: googleapi: Error 400: Cloud KMS error when using key projects/k8s-infra-e2e-boskos-062/locations/global/keyRings/gce-pd-csi-test-ring/cryptoKeys/test-key-1c952bf4-c58c-4b41-9993-1102071d948b: Permission 'cloudkms.cryptoKeyVersions.useToEncrypt' denied on resource 'projects/k8s-infra-e2e-boskos-062/locations/global/keyRings/gce-pd-csi-test-ring/cryptoKeys/test-key-1c952bf4-c58c-4b41-9993-1102071d948b' (or it may not exist)., kmsPermissionDenied%!v(MISSING)
  Expected
      <*status.Error | 0xc00012f4d0>: 
      rpc error: code = InvalidArgument desc = CreateVolume failed: rpc error: code = InvalidArgument desc = CreateVolume failed to create single zonal disk gcepd-csi-e2e-2ee8c344-aab9-42c0-8ba2-6aaffc3d24ab: failed to insert zonal disk: unknown Insert disk error: googleapi: Error 400: Cloud KMS error when using key projects/k8s-infra-e2e-boskos-062/locations/global/keyRings/gce-pd-csi-test-ring/cryptoKeys/test-key-1c952bf4-c58c-4b41-9993-1102071d948b: Permission 'cloudkms.cryptoKeyVersions.useToEncrypt' denied on resource 'projects/k8s-infra-e2e-boskos-062/locations/global/keyRings/gce-pd-csi-test-ring/cryptoKeys/test-key-1c952bf4-c58c-4b41-9993-1102071d948b' (or it may not exist)., kmsPermissionDenied%!v(MISSING)
      {
          s: {
              s: {
                  state: {
                      NoUnkeyedLiterals: {},
                      DoNotCompare: [],
                      DoNotCopy: [],
                      atomicMessageInfo: nil,
                  },
                  sizeCache: 0,
                  unknownFields: nil,
                  Code: 3,
                  Message: "CreateVolume failed: rpc error: code = InvalidArgument desc = CreateVolume failed to create single zonal disk gcepd-csi-e2e-2ee8c344-aab9-42c0-8ba2-6aaffc3d24ab: failed to insert zonal disk: unknown Insert disk error: googleapi: Error 400: Cloud KMS error when using key projects/k8s-infra-e2e-boskos-062/locations/global/keyRings/gce-pd-csi-test-ring/cryptoKeys/test-key-1c952bf4-c58c-4b41-9993-1102071d948b: Permission 'cloudkms.cryptoKeyVersions.useToEncrypt' denied on resource 'projects/k8s-infra-e2e-boskos-062/locations/global/keyRings/gce-pd-csi-test-ring/cryptoKeys/test-key-1c952bf4-c58c-4b41-9993-1102071d948b' (or it may not exist)., kmsPermissionDenied%!v(MISSING)",
                  Details: nil,
              },
          },
      }
  to be nil�[0m
  �[38;5;9mIn �[1m[It]�

@pwschuurman
Copy link
Contributor Author

pwschuurman commented Jun 25, 2024

@pwschuurman
Copy link
Contributor Author

/retest

@mattcary
Copy link
Contributor

/lgtm
/approve

thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 25, 2024
@Sneha-at
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattcary, pwschuurman, Sneha-at

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [mattcary,pwschuurman]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pwschuurman
Copy link
Contributor Author

/retest

1 similar comment
@pwschuurman
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit 2c23b17 into kubernetes-sigs:master Jun 26, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants