本文整理汇总了Python中UtilLibrary.flush_iptables方法的典型用法代码示例。如果您正苦于以下问题:Python UtilLibrary.flush_iptables方法的具体用法?Python UtilLibrary.flush_iptables怎么用?Python UtilLibrary.flush_iptables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UtilLibrary
的用法示例。
在下文中一共展示了UtilLibrary.flush_iptables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import flush_iptables [as 别名]
"user": "username",
"pass": "password"
}
}
Usage:python rejoin.py
"""
import sys
sys.path.append('../../../csit/libraries')
import UtilLibrary
import json
try:
with open('cluster.json') as cluster_file:
data = json.load(cluster_file)
except:
print str(sys.exc_info())
print "unable to open the file cluster.json"
exit(1)
try:
cluster_list = data["cluster"]["controllers"]
user_name = data["cluster"]["user"]
user_pass = data["cluster"]["pass"]
except:
print str(sys.exc_info())
print 'Error reading the file cluster.json'
exit(1)
print UtilLibrary.flush_iptables(cluster_list, user_name, user_pass)
示例2: open
# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import flush_iptables [as 别名]
try:
with open('cluster.json') as cluster_file:
data = json.load(cluster_file)
except:
print str(sys.exc_info())
print 'unable to open the file cluster.json'
exit(1)
try:
controllers = data["cluster"]["controllers"]
user_name = data["cluster"]["user"]
user_pass = data["cluster"]["pass"]
except:
print str(sys.exc_info())
print 'Error reading the file cluster.json'
exit(1)
try:
isolate = int(sys.argv[1])
duration = int(sys.argv[2])
except:
print 'You must specify the number (e.g. 1, 2, 3) of the controller to isolate.'
exit(1)
print 'Isolating controller ' + str(isolate)
print UtilLibrary.isolate_controller(controllers, user_name, user_pass, isolate)
print 'Pausing for ' + str(duration) + ' seconds...'
time.sleep(duration)
print UtilLibrary.flush_iptables(controllers, user_name, user_pass)