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

Check for nil ptr proxy-url value in troubleshoot util #436

Merged
merged 2 commits into from
Jun 11, 2024

Conversation

nephomaniac
Copy link
Contributor

What type of PR is this?

bug

What this PR does / Why we need it?

Fixes nil pointer deference seg fault during the troubleshoot util
Adds notice in the troubleshoot util for missing config file if not found at the expected path.

Which Jira/Github issue(s) does this PR fix?

Resolves #

Special notes for your reviewer

This should address the following error when "proxy-url" value is not set in the current configuration file/path, and not provided as an environment var.

[BP]➜ ~/rh_sandbox/backplane-cli/ git:(main) ✗ ./ocm-backplane config troubleshoot
[V] backplane-cli configuration path: /Users/maclark/.config/backplane/config.json
WARN[0001] No proxy configuration available. This may result in failing commands as backplane-api is only available from select networks. 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1036af5ec]

goroutine 1 [running]:
github.com/openshift/backplane-cli/cmd/ocm-backplane/config.(*troubleshootOptions).checkBPCli(0x0?)
	/Users/maclark/rh_sandbox/backplane-cli/cmd/ocm-backplane/config/troubleshoot.go:73 +0x20c
github.com/openshift/backplane-cli/cmd/ocm-backplane/config.(*troubleshootOptions).run(0x1059c0968, 0x43995fd100000000?, {0x14000605b68?, 0x0?, 0x0?})
	/Users/maclark/rh_sandbox/backplane-cli/cmd/ocm-backplane/config/troubleshoot.go:122 +0x20
github.com/spf13/cobra.(*Command).execute(0x14000485808, {0x1059c0968, 0x0, 0x0})
	/Users/maclark/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x105881980)
	/Users/maclark/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/maclark/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
main.Execute()
	/Users/maclark/rh_sandbox/backplane-cli/cmd/ocm-backplane/root.go:56 +0x24
main.main()
	/Users/maclark/rh_sandbox/backplane-cli/cmd/ocm-backplane/main.go:20 +0x1c

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

@nephomaniac
Copy link
Contributor Author

/retest

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 45.89%. Comparing base (c21ada9) to head (0370068).
Report is 14 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #436      +/-   ##
==========================================
+ Coverage   44.51%   45.89%   +1.37%     
==========================================
  Files          63       63              
  Lines        5284     5731     +447     
==========================================
+ Hits         2352     2630     +278     
- Misses       2615     2767     +152     
- Partials      317      334      +17     
Files Coverage Δ
cmd/ocm-backplane/config/troubleshoot.go 63.29% <16.66%> (-4.28%) ⬇️

... and 4 files with indirect coverage changes

@feichashao
Copy link
Contributor

/lgtm
/approve

@feichashao
Copy link
Contributor

@nephomaniac Thank you for fixing this!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 11, 2024
Copy link
Contributor

openshift-ci bot commented Jun 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feichashao, nephomaniac

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:

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 11, 2024
Copy link
Contributor

openshift-ci bot commented Jun 11, 2024

@nephomaniac: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 8175715 into openshift:main Jun 11, 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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants