Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Use last-ditch manifest parser for error reporting #1471

Merged
merged 6 commits into from Sep 28, 2015
Merged

Use last-ditch manifest parser for error reporting #1471

merged 6 commits into from Sep 28, 2015

Conversation

krnowak
Copy link
Collaborator

@krnowak krnowak commented Sep 24, 2015

Text below copied from #1266.

Example output of rkt list:

Unable to load manifest of pod 1ad35d47-34a4-4800-ac34-088f7a8f75ee: ACName must contain only lower case alphanumeric characters plus "-"
Invalid pod manifest - version: 0.7.0+git
  App: "!redis" from image "redis" (sha512-afe588bd39c1e5b6e85743d0fbfde921cc895eeee9e64dac8c31b4647a12577c)
Unable to load manifest of pod 22fc87d3-9c53-4b35-b83d-d3d19a865f9c: ACName must contain only lower case alphanumeric characters plus "-"
Invalid pod manifest - version: 0.7.0+git
  App: "busybox~" from image "busybox" (sha512-bf885104dc06468d8458c43d3f7f66774da77c62c09574de22d1bce17fd14df4)
UUID        APP ACI     STATE   NETWORKS
2f969bfd    redis   redis       exited  
70020f80    busybox busybox     exited  
7b6c7615    busybox busybox     exited  
85390bde    redis   redis       exited  
8a1549f5    busybox busybox     exited  
952a459a    etcd    coreos.com/etcd exited  
bf59d559    etcd    coreos.com/etcd exited  
ebaae473    etcd    coreos.com/etcd exited

@jonboulle
Copy link
Contributor

This is a great start, but I'm wondering if we can make the message a bit more helpful (e.g. maybe showing the current rkt's appc version?)

Paging @robszumski if he has any time to advise..

@robszumski
Copy link
Contributor

What about something like this?

2 errors encountered when listing pods:
---------------------------------------
Unable to load manifest of pod 1ad35d47-34a4-4800-ac34-088f7a8f75ee (version: 0.7.0+git) because it is invalid:
  ACName must contain only lower case alphanumeric characters plus "-"
Objects related to this error:
  App: "!redis" from image "redis" (sha512-afe588bd39c1e5b6e85743d0fbfde921cc895eeee9e64dac8c31b4647a12577c)
---------------------------------------
Unable to load manifest of pod 22fc87d3-9c53-4b35-b83d-d3d19a865f9c (version: 0.7.0+git) because it is invalid:
  ACName must contain only lower case alphanumeric characters plus "-"
Objects related to this error:
  App: "busybox~" from image "busybox" (sha512-bf885104dc06468d8458c43d3f7f66774da77c62c09574de22d1bce17fd14df4)
---------------------------------------

UUID        APP ACI     STATE   NETWORKS
2f969bfd    redis   redis       exited  
70020f80    busybox busybox     exited  
7b6c7615    busybox busybox     exited  
85390bde    redis   redis       exited  
8a1549f5    busybox busybox     exited  
952a459a    etcd    coreos.com/etcd exited  
bf59d559    etcd    coreos.com/etcd exited  
ebaae473    etcd    coreos.com/etcd exited

@alban alban mentioned this pull request Sep 28, 2015
3 tasks
krnowak and others added 4 commits September 28, 2015 15:38
We usually don't use this style. Also, in one line we did not return
any value, so a default integer value was returned instead (as the
return variable was not set to anything, so it defaulted to 0). This
meant returning 0 even if we could not get ACI infos.

Also removed the same from pod list command.
This replaces a tabOut global variable with a function that sets up a
new tab writer consistently, but allows caller to customize the
backing io.Writer.

In later commits, the `rkt image list` and `rkt list` commands will
change the backing writer to the bytes buffer to ensure that the list
is written after all the errors.
Simply put value in an array and join it later with tab as a
separator.
GetImageManifestJSON returns the manifest as bytes to be parsed. So if
this function returns an error, it means that the image was actually
removed.

GetImageManifest might return an error in two cases - either the image
was removed or its manifest was invalid.

The GetImageManifestJSON will be used in rkt image list.
@krnowak
Copy link
Collaborator Author

krnowak commented Sep 28, 2015

Current output of rkt image list:

2 error(s) encountered when listing images:
----------------------------------------
Unable to load manifest of image busybox! (spec version 0.5.1) because it is invalid:
  ACIdentifier must contain only lower case alphanumeric characters plus "-._~/"
----------------------------------------
Unable to load manifest of an image because it is invalid:
  bad ACKind: ImageManifesto
  Also, failed to get any information about invalid image manifest:
    missing or bad ACKind (must be "ImageManifest")
----------------------------------------
Misc:
  rkt's appc version: 0.7.0

KEY         NAME                    IMPORT TIME LATEST
sha512-a456de56264e coreos.com/rkt/stage1:0.8.1+git79b467f  1 week ago  false
sha512-2e76ba48ad02 coreos.com/rkt/stage1:0.8.1+git490627a  6 days ago  false

And current output of rkt list:

2 error(s) encountered when listing pods:
----------------------------------------
Unable to load image sha512-5a50ab0b775847eaddb47d08d2c184fac7484a64c4c32beaebbc0a082a54062b manifest (spec version unknown) because it is invalid:
  bad ACKind: ImageManifesto
  Also, failed to get any information about invalid image manifest:
    missing or bad ACKind (must be "ImageManifest")
Objects related to this error:
  App: "busybox" from failing image "busybox" (sha512-5a50ab0b775847eaddb47d08d2c184fac7484a64c4c32beaebbc0a082a54062b)
  Pod 023e9f6a-d793-4cb9-807b-2d11294b5a8c (spec version 0.8.1+git490627a) with following apps:
    App: "busybox" from image "busybox" (sha512-5a50ab0b775847eaddb47d08d2c184fac7484a64c4c32beaebbc0a082a54062b)
----------------------------------------
Unable to load image sha512-5a50ab0b775847eaddb47d08d2c184fac7484a64c4c32beaebbc0a082a54062b manifest (spec version unknown) because it is invalid:
  bad ACKind: ImageManifesto
  Also, failed to get any information about invalid image manifest:
    missing or bad ACKind (must be "ImageManifest")
Objects related to this error:
  App: "busybox" from failing image "busybox" (sha512-5a50ab0b775847eaddb47d08d2c184fac7484a64c4c32beaebbc0a082a54062b)
  Pod 610814b7-872b-4013-ac2b-48fa674279a2 (spec version 0.8.1+git79b467f) with following apps:
    App: "busybox" from image "busybox" (sha512-5a50ab0b775847eaddb47d08d2c184fac7484a64c4c32beaebbc0a082a54062b)
----------------------------------------
Misc:
  rkt's appc version: 0.7.0
----------------------------------------

UUID    APP ACI STATE   NETWORKS

})
uuid = ""
state = ""
nets = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make uuid, state, nets variables local to the for loop so that you don't have to clear them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a comment here then. It is cleared after first iteration, so subsequent iterations get empty values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it

@krnowak
Copy link
Collaborator Author

krnowak commented Sep 28, 2015

Current output of rkt image list:

2 error(s) encountered when listing images:
----------------------------------------
Unable to load manifest of image busybox! (spec version 0.5.1) because it is invalid:
  ACIdentifier must contain only lower case alphanumeric characters plus "-._~/"
ID of the invalid image:
  sha512-9d710100ce6769569b12a39100318bfed5b6b98115ee6315b724c11658db3751
----------------------------------------
Unable to load manifest of an image because it is invalid:
  bad ACKind: ImageManifesto
  Also, failed to get any information about invalid image manifest:
    missing or bad ACKind (must be "ImageManifest")
ID of the invalid image:
  sha512-5a50ab0b775847eaddb47d08d2c184fac7484a64c4c32beaebbc0a082a54062b
----------------------------------------
Misc:
  rkt's appc version: 0.7.0

KEY         NAME                    IMPORT TIME LATEST
sha512-a456de56264e coreos.com/rkt/stage1:0.8.1+git79b467f  1 week ago  false
sha512-2e76ba48ad02 coreos.com/rkt/stage1:0.8.1+git490627a  6 days ago  false

(Added the ID of the invalid image: line)

lines = append(lines, " Also, failed to get any information about invalid image manifest:")
lines = append(lines, fmt.Sprintf(" %v", imErr))
}
lines = append(lines, "ID of the invalid image:")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing two space to indent "Id of the invalid image:"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh no, it's ok like this.

@alban
Copy link
Member

alban commented Sep 28, 2015

LGTM if green. Thanks!

krnowak added a commit that referenced this pull request Sep 28, 2015
Use last-ditch manifest parser for error reporting
@krnowak krnowak merged commit f600f39 into rkt:master Sep 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants