1
0
mirror of https://github.com/Adam-Ant/drone-trigger synced 2024-12-20 07:24:34 +00:00

Merge pull request #1 from frebib/master

Fix some bugs, add some functionality :)
This commit is contained in:
Adam Dodman 2017-10-31 21:57:24 +00:00 committed by GitHub
commit 75f51fa233
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,9 +79,12 @@ def jsonVal(url, struct):
try: try:
for i in struct.split('.'): for i in struct.split('.'):
if i.isdigit():
dataDict = dataDict[int(i)]
else:
dataDict = dataDict[i] dataDict = dataDict[i]
return dataDict return dataDict
except KeyError: except:
print('Error: Invalid structure: ' + struct) print('Error: Invalid structure: ' + struct)
print(dataDict) print(dataDict)
raise raise
@ -136,6 +139,7 @@ if __name__ == '__main__':
try: try:
curr_value = jsonVal(config[service].get('url'), config[service].get('structure')) curr_value = jsonVal(config[service].get('url'), config[service].get('structure'))
except: except:
print('Error: Could not get current value for ' + service)
exit(1) exit(1)
print('Writing Initial value for ' + service + ': ' + curr_value) print('Writing Initial value for ' + service + ': ' + curr_value)
config[service]['current_value'] = curr_value config[service]['current_value'] = curr_value