1
0
mirror of https://github.com/Adam-Ant/drone-trigger synced 2024-11-05 05:36:23 +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:
for i in struct.split('.'):
dataDict = dataDict[i]
if i.isdigit():
dataDict = dataDict[int(i)]
else:
dataDict = dataDict[i]
return dataDict
except KeyError:
except:
print('Error: Invalid structure: ' + struct)
print(dataDict)
raise
@ -136,6 +139,7 @@ if __name__ == '__main__':
try:
curr_value = jsonVal(config[service].get('url'), config[service].get('structure'))
except:
print('Error: Could not get current value for ' + service)
exit(1)
print('Writing Initial value for ' + service + ': ' + curr_value)
config[service]['current_value'] = curr_value