Use last-ditch manifest parser for error reporting #1471
Conversation
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.. |
What about something like this?
|
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.
Current output of
And current output of
|
}) | ||
uuid = "" | ||
state = "" | ||
nets = "" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, got it
Current output of
(Added the |
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:") |
There was a problem hiding this comment.
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:"
There was a problem hiding this comment.
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.
LGTM if green. Thanks! |
Use last-ditch manifest parser for error reporting
Text below copied from #1266.
Example output of
rkt list
: