Franziska Kunsmann
7e15f8adc3
All checks were successful
bundlewrap/pipeline/head This commit looks good
36 lines
789 B
Python
36 lines
789 B
Python
#!/usr/bin/env python3
|
|
|
|
from requests import get
|
|
from sys import exit
|
|
|
|
api_key = '${api_key}'
|
|
|
|
try:
|
|
json = get('http://[::1]:22030/plugin/softwareupdate/check', headers={'X-Api-Key': api_key}).json()
|
|
except Exception as e:
|
|
print(repr(e))
|
|
exit(3)
|
|
|
|
updates = set()
|
|
|
|
for identifier, info in json['information'].items():
|
|
if info['updateAvailable']:
|
|
updates.add('{} ({} → {})'.format(
|
|
info['displayName'],
|
|
info['information']['local']['value'],
|
|
info['information']['remote']['value'],
|
|
))
|
|
|
|
if len(updates) > 0:
|
|
print('{} update{} available'.format(
|
|
len(updates),
|
|
'' if len(updates) == 1 else 's',
|
|
))
|
|
|
|
for line in sorted(updates):
|
|
print(line)
|
|
|
|
exit(2)
|
|
else:
|
|
print('OK')
|
|
exit(0)
|