Skip to content

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