Thank you all. Jeff,
you solution of using env.use_shell = False worked great. Thanks, santosh D On Sun, Oct 23, 2016 at 5:24 AM, Jeff Forcier <[email protected]> wrote: > You might also want to try setting env.use_shell = False. > > On Sat, Oct 22, 2016 at 3:28 PM, Brandon Whaley <[email protected]> > wrote: > >> It sounds like that user is not allowed to run shells. Try setting >> env.shell to an empty string. You'll lose the ability to use any shell >> specific commands via run but what you're running in your example should be >> fine. >> >> On Sat, Oct 22, 2016 at 1:29 PM santosh kumar <[email protected]> >> wrote: >> >>> if i am trying to connect over a normal ssh connect it working good. >>> >>> how to use the "-i" option in fabric, do we need anyother options ? >>> for me fabric is working good with a username/password , code is good. >>> Just that i am not able to use the sshkey in the fabric file. >>> >>> Thanks, >>> santosh D >>> >>> On Sat, Oct 22, 2016 at 10:51 PM, R M Waters <[email protected]> >>> wrote: >>> >>> 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_b >>> y(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({"K >>> vm_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 >>> >> >> _______________________________________________ >> Fab-user mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/fab-user >> >> > > > -- > Jeff Forcier > Unix sysadmin; Python engineer > http://bitprophet.org >
_______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
