Esempio n. 1
0
             #"ethtool -i eth0; ethtool -i enp6s0",
             #"umount /data",
             ]
 cnt = 1
 if len(sys.argv) != 2 or (len(sys.argv) == 2 and sys.argv[1]) == '0':
     print "\nUsage: " + sys.argv[0] + " number\n"
     for cmd in cmd_list:
         print "\t" + str(cnt) + ": " + cmd + "\n"
         cnt += 1
 else:
     i = int(sys.argv[1]) - 1
     host_ip_list = sp_define.get_all_host_ip()
     result_dict = {}
     for host_ip in host_ip_list:
         if not host_ip in sp_define.HOST_LIST: continue
         ip_suffix = Util.get_ip_field(host_ip, 3)
         cmd = cmd_list[i]
         #print cmd
         cmd = cmd.replace('$$host_suffix$$', ip_suffix)
         print "\n"
         print '='*30 + host_ip + '='*30
         try:
             node = NodeCompute(host_ip)
             node.run_cmd(cmd)
             node.exit()
             result_dict[host_ip] = True
         except (pexpect.EOF):
             # for rhel 7.0 reboot cmd only
             if int(ip_suffix) in [131, 132, 141, 142] and cmd == 'reboot':
                 print "Warning: Connection is closed"
                 result_dict[host_ip] = True
Esempio n. 2
0
'''
Created on Aug 19, 2013

@author: huhe
'''

import simplejson as json
import re 


from main.define import Define
from lib.util import Util


if __name__ == '__main__':
    '''
    str1 = "wget Define.URL_IMAGE_LIST[0] -P Define.PATH_DOWNLOAD"
    print repr(str1)
    #str1 = string.Template("wget ${Define.URL_IMAGE_LIST[0]}".substitute(locals()))
    print eval("Define.PATH_DOWNLOADS")
    #print str1
    for i in eval("range(0, 3)"):
        print i
        
    file_json_step = Define.PATH_USNIC_JSON_LINUX + "wget_ucsm_firmware.json"    
    Util.run_test_step_list(file_json_step)
    '''
    
    print Util.get_ip_field("50.35.10.127", 3)