def __get_version(self):
'''
get jenkins version
:return:
'''
try:
html = urllib2.urlopen(self.url + '/login?from=%2F').read()
links = SoupStrainer('a' ,href = re.compile(VERSION_TAG))
version_text = BeautifulSoup(html, "html.parser", parse_only= links)
if version_text.text != "":
color_output("[+]....jenkins version is %s" % version_text.text)
version_re = re.findall(u"ver.\s(.*)" ,version_text.text)
if len(version_re) != 0:
if version_re[0][0:4] >= self.check_version:
self.user_link = ASYNCH_PEOPEL_PERFIX
else:
self.user_link = PEOPLE_PERFIX
else:
color_output("[-]....can't get jenkins version!")
sys.exit()
except urllib2.URLError,e:
color_output("[-]....can't get jenkins version!")
sys.exit()
except Exception,e:
color_output("[-]....get version error:%s" % str(e))
sys.exit()
评论列表
文章目录