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

connect_kwargs ambiguity check is too ambiguous #2033

Open
tjstub opened this issue Oct 31, 2019 · 2 comments
Open

connect_kwargs ambiguity check is too ambiguous #2033

tjstub opened this issue Oct 31, 2019 · 2 comments

Comments

@tjstub
Copy link

tjstub commented Oct 31, 2019

For Fabric 2.5 on python 3.6 (Ubuntu 18.04.1)

For the following call, I would expect this to work.

import fabric
connect_kwargs = {"username": "foo", "password": "bar"}
with fabric.Connection(host=host, port=22, connect_kwargs=connect_kwargs) as conn:
           ...

instead, I receive

ValueError: Refusing to be ambiguous: connect() kwarg 'username' was given both via regular arg and via connect_kwargs!

This error is confusing and probably wrong. If username is set to None, there should be nothing to be ambiguous about, but if the current behavior is upheld, the error message should probably change. I don't recall this being a problem in older releases.

@asciifaceman
Copy link

I believe this issue is arising because fabric is merging ~/.ssh/config with your given config. I am seeing this even when username is not in kwargs because fabric is adding it on its own

connection.py - 406:409

        # NOTE: we load SSH config data as early as possible as it has
        # potential to affect nearly every other attribute.
        #: The per-host SSH config data, if any. (See :ref:`ssh-config`.)
        self.ssh_config = self.config.base_ssh_config.lookup(host)

imho this should be optional behavior as it is introducing unexpected behavior to explicit connection arguments

@dreambeyondorange
Copy link

So was there any resolution to this?

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

No branches or pull requests

3 participants