示例#1
0
def nrun(cmd, argv, path=CMD_PATH):
    ssh = SSHConnect('esxi-server', password='******')
    args = (reduce(lambda x, y: '%s %s ' % (x, y), argv)).strip()
    cmd = r'%s/%s %s' % (path, cmd, args)
    try:
        ssh.nrun(cmd)
        ssh.close()
    except Exception, e:
        ssh.close()
        print e
示例#2
0
def nrun(cmd, argv, path=CMD_PATH):
	ssh = SSHConnect('esxi-server', password='******')
	args = (reduce(lambda x,y: '%s %s ' % (x,y), argv)).strip()
	cmd = r'%s/%s %s' % (path, cmd, args)
	try:
		ssh.nrun(cmd)
		ssh.close()
	except Exception, e:
		ssh.close()
		print e
示例#3
0
def run(cmd, argv, path=CMD_PATH):
	cnn = SSHConnect('esxi-server', password='******')
	args = (reduce(lambda x,y: '%s %s ' % (x,y), argv)).strip()
	cmd = r'%s/%s %s' % (path, cmd, args)
	#print 'run \'%s\'' % cmd
	#sys.exit()
	try:
		stdin, stdout, stderr = cnn.run(cmd)
		stat = stdout.channel.recv_exit_status()
		if stat:
			print stderr.read()
			sys.exit()
		#for std in stdout.readlines():
		#	print std,
		while True:
			line = stdout.readline()
			if not line:
				break
			print line.strip()
	except Exception, e:
		cnn.close()
		print e
示例#4
0
def run(cmd, argv, path=CMD_PATH):
    cnn = SSHConnect('esxi-server', password='******')
    args = (reduce(lambda x, y: '%s %s ' % (x, y), argv)).strip()
    cmd = r'%s/%s %s' % (path, cmd, args)
    #print 'run \'%s\'' % cmd
    #sys.exit()
    try:
        stdin, stdout, stderr = cnn.run(cmd)
        stat = stdout.channel.recv_exit_status()
        if stat:
            print stderr.read()
            sys.exit()
        #for std in stdout.readlines():
        #	print std,
        while True:
            line = stdout.readline()
            if not line:
                break
            print line.strip()
    except Exception, e:
        cnn.close()
        print e