Clean Code
This commit is contained in:
6
main.py
6
main.py
@@ -2,21 +2,19 @@ import json, sys, traceback
|
|||||||
|
|
||||||
def get_service_index():
|
def get_service_index():
|
||||||
for index, value in enumerate(json_data['service']):
|
for index, value in enumerate(json_data['service']):
|
||||||
if(value['name'] == service_name):
|
if(value['name'] == sys.argv[2]):
|
||||||
return index
|
return index
|
||||||
exit(traceback.print_exc())
|
exit(traceback.print_exc())
|
||||||
|
|
||||||
def set_latest_version():
|
def set_latest_version():
|
||||||
service_index = get_service_index()
|
service_index = get_service_index()
|
||||||
json_data["service"][service_index]["latest_version"] = tagName
|
json_data["service"][service_index]["latest_version"] = sys.argv[1]
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
exit(traceback.print_exc())
|
exit(traceback.print_exc())
|
||||||
|
|
||||||
tagName = sys.argv[1]
|
|
||||||
service_name = sys.argv[2]
|
|
||||||
file_path = "./candidate-version.json"
|
file_path = "./candidate-version.json"
|
||||||
|
|
||||||
with open(file_path, 'r') as json_file:
|
with open(file_path, 'r') as json_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user