-
Notifications
You must be signed in to change notification settings - Fork 2
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
cmd/unused will block if a disks metadata cannot be read #41
Comments
I think the root cause is that Line 89 in 1c93776
json blob. There are instances where the string may just be a sentence, such as:
Other disks' Description looks like so: {"kubernetes.io/created-for/pv/name":"pvc-<redacted>","kubernetes.io/created-for/pvc/name":"xxxx","kubernetes.io/created-for/pvc/namespace":"xxxxx"} We should add better detection here to ensure that not only is description not equal, but also that it can be marshalled. |
Further analysis: A large majority of the unused disks were created by kubernetes, which will set the description to be json encoded as a string. The one disk that failed was manually created and had it's description set as just a plain old string. So in this scenario I'm not sure how we want to really handle the error. I was able to ignore the error and run the program successfully, but this doesn't seem right. |
Yes, that is indeed the case, we assume these disks have a JSON string in its description. I suppose we could probably add an error field to |
As a short-term stopgap, I've confirmed that we can log the error and the rest of the application is still functional. That's what I would do to get it out the door. Long term, I think instead of logging our errors, we could accept that the string is not json and wrap it in something like What are your thoughts on that @inkel? |
Thanks for taking the time to investigate this! I'll see to add logging to the GCP provider (actually maybe all of them) and get things moving so the app continues working by logging the error instead of failing. As for the long term fix I don't know how much of a benefit that would bring us, because for that particular provider we are indeed expecting a JSON string with certain fields, so if those aren't there, then there's no point in crafting a valid JSON payload to parse, as we would still lack the information needed. Nevertheless, it is something to consider, I'll think about it. Again, thank you so much! ❤️ |
This has been reported in #41. Signed-off-by: Leandro López (inkel) <[email protected]>
When executing
unused -gcp.project $(gcloud config get project)
, if one of the disks does not get read correctly, it will block the application printing out the rest. Here's an example with the project and disk x'ed out:I would expect the program to print out disks it was able to find that are unused and potentially print out disks it could not read.
The text was updated successfully, but these errors were encountered: