I would work backwards by first figuring out what the sysadmin did to restrict login on the server, that info will help you figure out why ssh client works but fabric/paramiko doesn't. Or maybe you are doing something funny in `exec_remote_cmd`.
On Sat, Oct 22, 2016 at 12:56 PM, santosh kumar <[email protected]> wrote: > All, > > I have done all the set up for the private and public keys. Later when i > am using the ssh keys it working as expected. > > ssh -i latest_my_node_rsa m04949@chcilrsv130 'sudo /usr/bin/virsh list > --all' > _________________________________________________________________ > Id Name State > ---------------------------------------------------- > 2 chcilvLmong01 running > 3 chcilvlvipr02 running > 4 chcilvLswft01 running > 5 chcilvLcomp03 running > 6 chcilvLdbng01 running > 7 chcilvLmosc03 running > 8 chcilvLrosv01 running > > But the challenge is using it with fabric i am getting following errors > when trying with following setting from fabric > > > [chcilrsv130] Executing task 'kvm_gamma_car' > [chcilrsv130] run: sudo /usr/bin/virsh list --all > [chcilrsv130] out: ****************************** > ********************* > [chcilrsv130] out: ****************************** > ************************** > [chcilrsv130] out: ** Direct network login to this > account is disallowed ** > [chcilrsv130] out: ****************************** > ************************** > [chcilrsv130] out: ****************************** > ********************* > [chcilrsv130] out: > [chcilrsv130] out: > > > Warning: run() received nonzero return code 1 while executing 'sudo > /usr/bin/virsh list --all'! > > Following is the config file > > def kvm_gamma_car(): > ''' : This is a functionality to generate the list for kvm guests,kvm > hosts,kvm ips ''' > env.user = ADMIN > env.key_filename=KEY_PASS > cmdlist = {'virsh':'sudo /usr/bin/virsh list --all'} > try: > for key,cmd in cmdlist.items(): > results = exec_remote_cmd(cmd) > Nresults=re.findall('[0-9]+\s+(\S+)\s+\S+',results) > domain = re.search('\w+(\S+)',env.host).group(1) > print "\n Nresults: {} \n".format(Nresults) > if Nresults: > for value in Nresults: > gname = value+domain > kname = env.host > print "working on {} \n".format(gname,kname) > if session.query(MyNode).filter_by(Guest_Name=gname).count() < 1: > print "Adding the following entries - {},{} > \n".format(gname,kname) > Db_Entry(gname,kname) > elif > session.query(MyNode).filter_by(Guest_Name=gname).filter_by(Kvm_Name=kname).count() > == 1 : > print "Already have an entry for the same - > {},{}".format(gname,kname) > else: > print "updating a new entry - {},{}".format(gname,kname) > session.query(MyNode).filter_by(Guest_Name=gname).update({" > Kvm_Name":kname}) > session.commit() > else: > print "Adding the following entries - {},{} \n".format(kname,kname) > Db_Entry(gname,kname) > except: > kvm_down.write("{0},{1}\n".format("KVM NODE DOWN",env.host)) > > > ---- > ADMIN= 'm04949' > KEY_PASS = 'latest_my_node_rsa' > > Could you let me know where i am missing ? In btw its fabric Fabric==1.10.2 > > > Thanks, > Santosh D > > > > > _______________________________________________ > Fab-user mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/fab-user > >
_______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
