Bee
Bee

Reputation: 274

How to use threading and sudo in fabric 2?

My question is the same as this one, but I'm not thrilled with the only answer. fabric 2.3 parallel execution of sudo commands

Hoping there are other opinions out there?

I'm trying to migrate my Python 2/Fabric 1 code to Python 3/Fabric 2. The code performs a lot of tasks in parallel and runs commands as root on the remote machines. This worked in Fabric 1 but I am having trouble getting this to work with Fabric 2.

The ThreadingGroup class provides the parallelism I want, but does not have a sudo method. I tried implementing the answer from the original question, which is to copy the run method from ThreadingGroup, make a few changes, and call it "sudo". This didn't work for me, saying I need a tty to sudo.

I also submitted my question to the fabric mailing list. I will update my question here if I get a response from them.

Upvotes: 2

Views: 294

Answers (0)

Related Questions