update update_con_network.py

This commit is contained in:
zhuyj17 2017-05-19 22:11:00 +08:00
parent 9651d05d47
commit 5b6586a43e
1 changed files with 9 additions and 3 deletions

View File

@ -2,8 +2,11 @@ import sys,os
sys.path.append("../src/")
import env,requests
userpoint = "http://" + env.getenv('USER_IP') + ":" + str(env.getenv('USER_PORT'))
G_userip = env.getenv("USER_IP")
if len(sys.argv) < 2:
print("Please enter USER_IP")
exit()
userpoint = "http://" + sys.argv[1] + ":" + str(env.getenv('USER_PORT'))
auth_key = env.getenv('AUTH_KEY')
def post_to_user(url = '/', data={}):
@ -15,7 +18,10 @@ for con in cons:
namesplit = con.split('-')
user = namesplit[0]
res = post_to_user('/user/uid/',{'username':user,'auth_key':auth_key})
configfile = open('/var/lib/lxc/'+con+'/config','r')
try:
configfile = open('/var/lib/lxc/'+con+'/config','r')
except:
continue
context = configfile.read()
configfile.close()
#print(context)