Discussion:
[Fab-user] Fabric parallelism error
chinky gupta
2016-03-09 10:38:39 UTC
Permalink
I am getting a fatal error: Needed to prompt for a connection or sudo
password

One or more hosts fail to execute task

While i was trying to achieve parallelism through fabric
I have tried using decorators like @parallel or @runs_ parllel
as well as command line arguments like -P or -z
I am really getting troubled while executing this program..I dont know
where does problem really exists.

Waiting for your earlier reply
Nitesh Nanotkar
2016-03-09 13:04:19 UTC
Permalink
Hi,
Set env.hosts=['ur ips'] e.g env.hosts =
['1.2.3.4','8.8.8.8']
Set env.password = "common password". It should work.

Thanks!
Post by chinky gupta
I am getting a fatal error: Needed to prompt for a connection or sudo
password
One or more hosts fail to execute task
While i was trying to achieve parallelism through fabric
as well as command line arguments like -P or -z
I am really getting troubled while executing this program..I dont know
where does problem really exists.
Waiting for your earlier reply
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Carlos García
2016-03-09 13:06:34 UTC
Permalink
Hi

If you run your tasks in parallel, the task should not need any interactive
input, because Fabric doesn’t know where to send your input.

The message you’re getting it’s because your task is asking for sudo
password. Use the -p to provide the password, or set it in env.password as
Nitesh suggested, or configure your hosts to avoid asking for password in
sudo.

Regards
​
Post by Nitesh Nanotkar
Hi,
Set env.hosts=['ur ips'] e.g env.hosts =
['1.2.3.4','8.8.8.8']
Set env.password = "common password". It should work.
Thanks!
Post by chinky gupta
I am getting a fatal error: Needed to prompt for a connection or sudo
password
One or more hosts fail to execute task
While i was trying to achieve parallelism through fabric
as well as command line arguments like -P or -z
I am really getting troubled while executing this program..I dont know
where does problem really exists.
Waiting for your earlier reply
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
chinky gupta
2016-03-09 13:40:37 UTC
Permalink
I have set env.password variable too
But still it was not working
Not even asking for any password either using env.password or -p option in
command line

Please describe the process of how to provide key pair with -i option
I have created key pair using ssh keygen option and also copied the public
key to the host i am trying to connect
On Mar 9, 2016 6:36 PM, "Carlos García" <
Post by Carlos García
Hi
If you run your tasks in parallel, the task should not need any
interactive input, because Fabric doesn’t know where to send your input.
The message you’re getting it’s because your task is asking for sudo
password. Use the -p to provide the password, or set it in env.password
as Nitesh suggested, or configure your hosts to avoid asking for password
in sudo.
Regards
​
Post by Nitesh Nanotkar
Hi,
Set env.hosts=['ur ips'] e.g env.hosts =
['1.2.3.4','8.8.8.8']
Set env.password = "common password". It should work.
Thanks!
Post by chinky gupta
I am getting a fatal error: Needed to prompt for a connection or sudo
password
One or more hosts fail to execute task
While i was trying to achieve parallelism through fabric
as well as command line arguments like -P or -z
I am really getting troubled while executing this program..I dont know
where does problem really exists.
Waiting for your earlier reply
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Nitesh Nanotkar
2016-03-09 15:16:52 UTC
Permalink
Hi,
Go through below code. Create "ips" file containing all ips
each on new line.
Run the code file as : python "your new code file name"

==================================================================================
from fabric.api import *
import fabric

env.timeout = 15
env.connection_attempts = 2
env.pool_size = 50
env.parallel = 'true'
env.user = 'root'
env.password = '***@123'
env.port = 22


def workon():
for line in open('ips','r').readlines():
host = line.strip('\n')
env.hosts.append(host)

def run_cmd2():
try:
run('')

except:
writeFile(env.host)

def writeFile(servIp):
f=open("nonConn","a")
f.write("%s\n"%(servIp))
f.close()


if __name__ == "__main__":
workon()
print execute(run_cmd2)
===================================================================================

It works of me as I don't like to use fab command on terminal.

Thanks!
Post by chinky gupta
I have set env.password variable too
But still it was not working
Not even asking for any password either using env.password or -p option in
command line
Please describe the process of how to provide key pair with -i option
I have created key pair using ssh keygen option and also copied the public
key to the host i am trying to connect
On Mar 9, 2016 6:36 PM, "Carlos García" <
Post by Carlos García
Hi
If you run your tasks in parallel, the task should not need any
interactive input, because Fabric doesn’t know where to send your input.
The message you’re getting it’s because your task is asking for sudo
password. Use the -p to provide the password, or set it in env.password
as Nitesh suggested, or configure your hosts to avoid asking for password
in sudo.
Regards
​
Post by Nitesh Nanotkar
Hi,
Set env.hosts=['ur ips'] e.g env.hosts =
['1.2.3.4','8.8.8.8']
Set env.password = "common password". It should work.
Thanks!
Post by chinky gupta
I am getting a fatal error: Needed to prompt for a connection or sudo
password
One or more hosts fail to execute task
While i was trying to achieve parallelism through fabric
as well as command line arguments like -P or -z
I am really getting troubled while executing this program..I dont know
where does problem really exists.
Waiting for your earlier reply
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Loading...