Skip to content
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

No panic when getting a plan status for an instance with no plan #461

Merged
merged 3 commits into from
Jul 1, 2019

Conversation

zen-dog
Copy link
Contributor

@zen-dog zen-dog commented Jun 28, 2019

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/component generator
/component kudoctl
/component operator
/kind api-change

/kind bug

/kind cleanup
/kind design
/kind documentation
/kind feature
/kind enhancement
/kind infrastructure
/kind kep

What this PR does / why we need it:
In certain edge case situations (like a controller outage) an instance might not have an activePlan.status set. This fixes a cli-panic when querying a plan status for such an instance.

Which issue(s) this PR fixes:

Fixes #459

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

In certain edge case situations (like a controller outage) an instance might not have an `activePlan.status` set. This fixes a cli panic when querying a plan status for such an instance.

Issues: #459
@@ -621,3 +622,8 @@ func (r *ReconcilePlanExecution) Cleanup(obj runtime.Object) error {

return nil
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unrelated to the bug, just making our lives easier when debugging integration tests.

Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

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

nice work. I have a strong preference to move prettyPrint to be a util outside of planexec... but this is a great improvement.

func prettyPrint(i interface{}) string {
s, _ := json.MarshalIndent(i, "", " ")
return string(s)
}
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be in a json util package? this is not planexec specific

Copy link
Member

Choose a reason for hiding this comment

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

as I reason through this more... this function literal swallows the err. what is the output for an error? do we not want any indication there was an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's why I haven't put it into util package - I didn't want a general purpose prettyPrint method for everybody (though it can be). So far, I only saw planexecution_controller printing gigantic yaml object in our logs.

Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

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

Nice 🕵 work! :)

@alenkacz alenkacz merged commit f53d245 into master Jul 1, 2019
alenkacz pushed a commit that referenced this pull request Jul 9, 2019
In certain edge case situations (like a controller outage) an instance might not have an `activePlan.status` set. This fixes a cli panic when querying a plan status for such an instance.

Issues: #459
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic during plan status
3 participants