pixel/get-new-device-vars: Handle failure gracefully
Change-Id: Ia26addd1c68ac98e66d69f0933871be29dd2849a
This commit is contained in:
committed by
Michael Bestas
parent
6688187cd0
commit
5364d09700
@@ -61,13 +61,21 @@ def get_aosp_tag_for_build_id(aosp_tags, wanted_build_id):
|
|||||||
if found_build_id == wanted_build_id:
|
if found_build_id == wanted_build_id:
|
||||||
print('new_aosp_tag="{0}"'.format(aosp_tag))
|
print('new_aosp_tag="{0}"'.format(aosp_tag))
|
||||||
return aosp_tag
|
return aosp_tag
|
||||||
|
print('new_aosp_tag="unknown"')
|
||||||
|
return 'unknown'
|
||||||
|
|
||||||
def get_security_patch_for_aosp_tag(aosp_tag):
|
def get_security_patch_for_aosp_tag(aosp_tag):
|
||||||
output = base64.decodebytes(urllib.request.urlopen(SECURITY_PATCH_URL.format(aosp_tag)).read()).decode()
|
try:
|
||||||
|
output = base64.decodebytes(urllib.request.urlopen(SECURITY_PATCH_URL.format(aosp_tag)).read()).decode()
|
||||||
|
except:
|
||||||
|
print('new_security_patch=unknown')
|
||||||
|
return
|
||||||
for line in output.split('\n'):
|
for line in output.split('\n'):
|
||||||
if SECURITY_PATCH_FILTER in line:
|
if SECURITY_PATCH_FILTER in line:
|
||||||
security_patch = line.split(":=")[1].strip()
|
security_patch = line.split(":=")[1].strip()
|
||||||
print('new_security_patch="{0}"'.format(security_patch))
|
print('new_security_patch="{0}"'.format(security_patch))
|
||||||
|
return
|
||||||
|
print('new_security_patch="unknown"')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|||||||
Reference in New Issue
Block a user