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

Group class lacking sudo method #1999

Closed
BonnieH opened this issue Aug 7, 2019 · 3 comments
Closed

Group class lacking sudo method #1999

BonnieH opened this issue Aug 7, 2019 · 3 comments

Comments

@BonnieH
Copy link

BonnieH commented Aug 7, 2019

Fabric 1 contained the ability to run code as root in parallel. My organization has a collection of scripts that run commands on remote hosts in parallel and as sudo. ThreadingGroup has the parallelism we need, and Connection has the sudo method, but there isn't a class that has both.

This seems like a major problem with Fabric 2, but I haven't found anyone else discussing this issue. Is there a common workaround? Are there plans to create this functionality soon? Any feedback is appreciated.

@L1ghtman2k
Copy link

#1912

@nandoflorestan
Copy link

I see in the source code (in the Group classes) that sudo() is planned, but not yet implemented. Same for local(). As far as I know we are also missing the context managers cd() and prefix(), I do not suppose those work with Groups.

I also see that Connection is a subclass of Invoke's Context, but Group isn't -- this is a weird decision, probably coming from the fact that Group needs to collect results from multiple computers.

Maybe the design of Fabric 2 should have been just a little different. Personally I would have tried separating sets of commands (e. g. ["apt update", "apt upgrade"] is a set of 2 commands] from where they run (Local, Remote, Group) and then requiring these 2 separate things at the end to run any one command: run(command_set, where=a_group_of_servers, parallel=True)

Just thinking out loud.

@bitprophet
Copy link
Member

Working on this now. Works pretty well in practice. Will be releasing under Fabric 2.6 today hopefully.

It "wants" another ticket I can't find right now that is for supporting per-host config data (eg so you can say host1 has sudo password A, and host2 has sudo password B). But in the interim, Group.from_connections([Connection('host1', config=Config({'sudo': {'password': 'xxx'}})), ...]) can function as a workaround. (In other words - construct individual Connections with their differing config values, then assemble those into a Group using the alt constructor).

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

4 participants