本文整理汇总了Python中OSConf.get_cache_file方法的典型用法代码示例。如果您正苦于以下问题:Python OSConf.get_cache_file方法的具体用法?Python OSConf.get_cache_file怎么用?Python OSConf.get_cache_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSConf
的用法示例。
在下文中一共展示了OSConf.get_cache_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_cache_file [as 别名]
def main():
global tcmsobj
global DEBUG
(options, args) = parse_cmdline()
try:
os.makedirs(get_tmp_dir())
#TODO: what about remove whole TMP_DIR?
# it seems to be safe if it is within $HOME/tmp/
except:
pass
shutil.rmtree(RUNDIR, True)
os.makedirs(RUNDIR)
try:
# Remove OSConf cache
os.remove(OSConf.get_cache_file())
os.remove("%s/libra_server-%s"%(get_tmp_dir(), OshiftUser))
except:
pass
'''
if options.client_version:
log.info("Setup rhc client to version: %s"%options.client_version)
try:
r = setup_rhc_client(options.client_version)
#r = update_rhc_client(options.client_version)
if r != 0:
raise Exception("")
except:
log.error("Unable to setup RHC client to given version!")
sys.exit(254)
'''
DEBUG = options.DEBUG
if DEBUG:
os.environ['RHTEST_DEBUG'] = '1'
# Priority for Instance Arguments: -a -> -m
if options.instance_ip != None:
# This branch is when you want to use existing instance
instance_ip = options.instance_ip
elif options.instance_ip_by_tag is not None:
# This branch is when you want to use previously
# launched/stopped instance
try:
if not options.instance_ip_by_tag.startswith('QE_'):
log.warning("Appending QE_ prefix for given instance tag!")
options.instance_ip_by_tag = 'QE_'+options.instance_ip_by_tag
instance_ip = get_instance_ip_by_tag(options.instance_ip_by_tag)
log.info("Found instance[%s] IP=%s"%(options.instance_ip_by_tag, instance_ip))
except Exception as e:
log.warning("Unable to get IP address from instance by tag: %s. (%s)"%
(options.instance_ip_by_tag, str(e)))
log.warning("Instance doesn't exist!")
log.warning("Therefoer a new instance is going to be launched.")
try:
instance_ip = create_node(options.instance_ip_by_tag, options.ami, options.image_size)
except Exception as e:
log.error("Unable to launch new instance with tag:%s. (%s)"%
(options.instance_ip_by_tag, str(e)))
sys.exit(254)
else:
# This is when you want to launch new instance
instance_ip = create_node(options.instance_tag, options.ami, options.image_size)
testplan_id = options.testplan_id
os.environ['OPENSHIFT_libra_server'] = instance_ip
set_libra_server(instance_ip)
#log.info("Platform: %s"%" ".join(platform.uname()))
#log.info(cmd_get_status_output("rhc --version; python --version; ruby --version", quiet=True)[1])
#log.info(aws_console.get_ami(get_instance_ip()))
#try:
# log.info("Host: %s"%socket.gethostbyname(socket.gethostname()))
#except:
# log.info("Host: %s"%socket.gethostname())
#Do TCMS authentication only once
tc_id_list = []
tc_tag_list = []
skip_tag_ids = []
if not options.FROM_DB:
tcmsobj = TCMS()
else:
global FROM_DB
FROM_DB = options.FROM_DB
if options.testcase_ids != None:
tmp_list = options.testcase_ids.split(',')
for i in tmp_list:
tc_id_list.append(int(i.strip()))
elif options.testcase_tags != None:
tmp_list = options.testcase_tags.split(',')
for i in tmp_list:
tc_tag_list.append(i.strip())
#print "--->", tc_tag_list
# remove need_update_auto tag
if options.skip_tags:
options.skip_tags = "xxx,%s"%(options.skip_tags)
#.........这里部分代码省略.........