Coder Social home page Coder Social logo

Comments (7)

max-arnold avatar max-arnold commented on July 27, 2024 14

Below is my current workaround for this issue:

def rsync_with_agent(ctx, *args, **kwargs):
    """Ugly workaround for https://github.com/fabric/patchwork/issues/16."""
    ssh_agent = os.environ.get('SSH_AUTH_SOCK', None)
    if ssh_agent:
        ctx.config['run']['env']['SSH_AUTH_SOCK'] = ssh_agent
    return rsync(ctx, *args, **kwargs)

from patchwork.

max-arnold avatar max-arnold commented on July 27, 2024

The reason seems to be replace_env = True in the fabric/config.py:

        # TODO: as to that, this is a core problem, Fabric wants split
        # local/remote stuff, eg replace_env wants to be False for local and
        # True remotely; shell wants to differ depending on target (and either
        # way, does not want to use local interrogation for remote)
        # TODO: is it worth moving all of our 'new' settings to a discrete
        # namespace for cleanliness' sake? e.g. ssh.port, ssh.user etc.
        # It wouldn't actually simplify this code any, but it would make it
        # easier for users to determine what came from which library/repo.
        defaults = InvokeConfig.global_defaults()
        ours = {
            # New settings
            'connect_kwargs': {},
            'forward_agent': False,
            'gateway': None,
            'load_ssh_configs': True,
            'port': 22,
            'run': {
                'replace_env': True,
            },
            'runners': {
                'remote': Remote,
            },

But I have no idea why it applies to local(). Any workarounds?

from patchwork.

bitprophet avatar bitprophet commented on July 27, 2024

Probably has to do with the currently-too-thin boundary between run and local, there are outstanding issues there that need solving and this feels like an example of one of them.

Eg I think what needs to happen is vanilla-Invoke's run() wants to honor config.run.* but Fabric 2 wants to clone config.run.* to be config.local.* so that the two can have differing defaults. That's a Fabric, not Patchwork, level change - to be clear.

I'm still trying to get Patchwork and Invocations both up to snuff re: being publication and pull request worthy, after that I'll get back to this sort of feature related work. PyCon sprints!

from patchwork.

sheluchin avatar sheluchin commented on July 27, 2024

I ran into the same issue and @max-arnold's workaround worked for me.

from patchwork.

bitprophet avatar bitprophet commented on July 27, 2024

This never got linked to fabric/fabric#1752 - once that is solved this may go away or at least be easier to fix.

from patchwork.

dherykw avatar dherykw commented on July 27, 2024

I am not able to use this workaround, still needing the password

from patchwork.

krupan avatar krupan commented on July 27, 2024

I'm having another problem related to this (problems with local mentioned above), trying to run my django unit tests before deploying:

c.local('poetry run python manage.py test')

Gives me this:

[KeyError]  
'PATH' 

But running remotely with c.run works just fine.

from patchwork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.