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

Connection port parsing #1125

Closed
wants to merge 5 commits into from
Closed

Conversation

memetb
Copy link
Contributor

@memetb memetb commented Oct 29, 2024

This issue is meant to address #1124

This is a subtle bug because it has practically no impact on the libvirt code base. It only affects libvirt here:

	if err := l.ConnectToURI(libvirt.ConnectURI(u.RemoteName())); err != nil {

Outside of this location, this bug only affects ssh_config settings by incorrectly passing the target as "hostname:portname" instead of "hostname" here:


	// configuration loaded, build tunnel
	sshClient, err := u.dialHost(u.Host, sshcfg, 0)
	if err != nil {
		return nil, err
	}

However, when a port override is specified in the ConnectionString, u.Host will contain the hostname.

@memetb
Copy link
Contributor Author

memetb commented Oct 29, 2024

The added unittest assertions in this PR reveal the problem here:

 === RUN   TestURI
    connection_uri_test.go:34: 
        	Error Trace:	/home/runner/work/terraform-provider-libvirt/terraform-provider-libvirt/libvirt/uri/connection_uri_test.go:34
        	Error:      	Not equal: 
        	            	expected: "hostname"
        	            	actual  : "hostname:2222"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-hostname
        	            	+hostname:2222
        	Test:       	TestURI

@memetb memetb closed this Oct 29, 2024
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.

1 participant