-
Notifications
You must be signed in to change notification settings - Fork 463
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
Sshconfig missing bugfix - addresses issue #1105 #1109
Conversation
Edit: OK, it appears path of least effort isn't going to work. I'm going to go over the code more closely. The solution below is possibly the wrong approach. The log output provided by @mvrk69 has the following relevant output:
This means that the loading of the sshconfig file initially fails here,
then code execution proceeds to here
which returns a nil for the This object is then queried multiple times inside the It's important to note that Because of the above complexity, and because I didn't want to change all the sites where the Finally, there is a bit of very defensive programming here where I simply die if for some reason |
the code would previously get the current user (current execution's context) whereas the cfg.User value already takes the ConnectionURI's set username which should be sufficient as a default value check.
Here is the updated code. Allows for graceful absence of |
I am ok with the current fix. But in retrospective I think the whole introduction of ssh config file support in this way was a mistake. What we should do is abstract the whole code flow to work with a final configuration. How this configuration is built should be in a single place. The ssConfig object being all over the place is not nice. The code with the loading of the file, overriding etc, should all be in a single place, and that is where the code that loads a empty file could be as well. |
@dmacvicar I understand the point you're making: there's an aspect of the current implementation that is messy. The thing to keep in mind if we do refactor, is that the ssh configuration can't be pre-computed without some serious state management. For instance, I've worked in environments where I had:
determining the outcome of these and pre-computing them into a dictionary is simply not possible. I think a second area of concern is the "level" the query string applies to: does it apply to each host along the way or just the end host etc? My vote would be to formalize the query string configuration into an object and formalize the library (terraform-provider-libvirt) api documentation to show the precedence of configuration, and then if it must be done, create a wrapper object which polls sshconfig and query string according to those rules. The important thing is that the config must specify the |
This PR addresses issue #1105. It is a minimal codefix, marking as WIP as I've made the decision to make it a minimal fix as opposed to a larger rewrite.
@dmacvicar I am open to any directives you have to give. I will separately comment on my design choice.