summaryrefslogtreecommitdiff
path: root/src/helpers/latest-image-url.py
blob: ea201ef7caf729ce2abe7b5cc64f7e014d15b1fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3

import sys

from vyos.configquery import ConfigTreeQuery
from vyos.version import get_remote_version


if __name__ == '__main__':
    image_path = ''

    config = ConfigTreeQuery()
    if config.exists('system update-check url'):
        configured_url_version = config.value('system update-check url')
        remote_url_list = get_remote_version(configured_url_version)
        if remote_url_list:
            image_path = remote_url_list[0].get('url')
        else:
            sys.exit(1)

    print(image_path)