Log In | Get Help   
Home My Page Projects Code Snippets Project Openings BonFIRE VCOC Demonstration Kit
Summary Activity SCM Files Wiki
[bonfiredemokit] Diff of /ea/ssh_test.py
[bonfiredemokit] / ea / ssh_test.py Repository:
ViewVC logotype

Diff of /ea/ssh_test.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 14, Mon Oct 8 09:46:28 2012 UTC revision 15, Tue Oct 9 14:42:19 2012 UTC
# Line 22  Line 22 
22    
23  """  """
24  ###################################################################  ###################################################################
25  # Es necesario hacer comparacion name in out y no al reves        #  # Checks name in out                                                            #
26  # ya que salida devuelve hostname con \n y si no no se cumple cond#  # because output includes hostname with \n and it fails otherwise#
27  ###################################################################  ###################################################################
28  """  """
29    
# Line 39  Line 39 
39      print name      print name
40      while name not in out and j<40:      while name not in out and j<40:
41          try:          try:
42              #print 'abro popen'              #print 'open popen'
43              fout = sub.Popen(cmd,bufsize=-1,shell=True,stdout=sub.PIPE, stderr=sub.STDOUT,close_fds=True)              fout = sub.Popen(cmd,bufsize=-1,shell=True,stdout=sub.PIPE, stderr=sub.STDOUT,close_fds=True)
44              #print 'salgo popen'              #print 'exit popen'
45              out,err =fout.communicate(input=None)              out,err =fout.communicate(input=None)
46          #    print 'communicate'          #    print 'communicate'
47              j = j + 1;              j = j + 1;
# Line 52  Line 52 
52                  print 'Host not available', j                  print 'Host not available', j
53                  time.sleep(float(5))                  time.sleep(float(5))
54              elif name not in out and j >= 40:              elif name not in out and j >= 40:
55                  print 'Sobrepasado el numero de intentos. 40'                  print 'Number of trials exeeded. 40'
56      if j < 40 and name in out:      if j < 40 and name in out:
57          print 'Host:', name, 'is ssh available', ip          print 'Host:', name, 'is ssh available', ip
58    
# Line 80  Line 80 
80                  print 'Host available', out, ip, j, err                  print 'Host available', out, ip, j, err
81                  time.sleep(float(5))                  time.sleep(float(5))
82              elif name in out and j >= 40:              elif name in out and j >= 40:
83                  print 'Sobrepasado el numero de intentos. 40'                  print 'Number of trials exceeded. 40'
84      if j < 40 and name not in out:      if j < 40 and name not in out:
85          print 'Host:', name, 'is not ssh available', j          print 'Host:', name, 'is not ssh available', j
86    
87    
88  def ssh_qhost(ip):  def ssh_qhost(ip):
89      "Comprobacion del qhost"      "Checking qhost"
90  #  #
91      cmd = 'ssh -q '+ip+' qhost -xml'      cmd = 'ssh -q '+ip+' qhost -xml'
92      out='command not found'      out='command not found'
# Line 94  Line 94 
94          fout = sub.Popen(cmd,bufsize=-1,shell=True,stdout=sub.PIPE, stderr=sub.STDOUT)          fout = sub.Popen(cmd,bufsize=-1,shell=True,stdout=sub.PIPE, stderr=sub.STDOUT)
95          out,err =fout.communicate()          out,err =fout.communicate()
96    
97      #print 'Salida qhost', out      #print 'Exit qhost', out
98      return out      return out
99    
100    
# Line 115  Line 115 
115  #    config.parse(file1)  #    config.parse(file1)
116  #    o = config.lookup('ip')  #    o = config.lookup('ip')
117  #    print 'nada', o  #    print 'nada', o
118  #    #print 'Dame el passwd para la clave'  #    #print 'Give password:'
119  #    #passwd=input()  #    #passwd=input()
120  #    #print passwd  #    #print passwd
121  #    try:  #    try:

Legend:
Removed from v.14  
changed lines
  Added in v.15

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge