diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2018-07-17 14:23:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-17 14:23:49 +0200 |
commit | 90d7ec219b8143a2f36a7c24631385ddbdffc9a9 (patch) | |
tree | 47b34fc2584ae9e7e330d85f312cfddbacfe0dcb /recipes-sota/aktualizr/garage-sign-version.inc | |
parent | 0ca9757e5a719255d041b23e3344fdc8636796d1 (diff) | |
parent | e1956a24a54fe0153c1e8b3cd8f742525b978478 (diff) | |
download | meta-updater-90d7ec219b8143a2f36a7c24631385ddbdffc9a9.tar.gz |
Merge pull request #358 from advancedtelematic/feat/bump-aktualizr-pro-h#3-master
Feat/bump aktualizr pro h#3 master
Diffstat (limited to 'recipes-sota/aktualizr/garage-sign-version.inc')
-rw-r--r-- | recipes-sota/aktualizr/garage-sign-version.inc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc index f2d04e8..1b89a3d 100644 --- a/recipes-sota/aktualizr/garage-sign-version.inc +++ b/recipes-sota/aktualizr/garage-sign-version.inc | |||
@@ -11,8 +11,21 @@ python () { | |||
11 | url = url_file.read().decode().strip(' \t\n') + '/health/version' | 11 | url = url_file.read().decode().strip(' \t\n') + '/health/version' |
12 | except (KeyError, ValueError, RuntimeError): | 12 | except (KeyError, ValueError, RuntimeError): |
13 | return | 13 | return |
14 | r = urllib.request.urlopen(url) | 14 | connected = False |
15 | if r.code != 200: | 15 | tries = 3 |
16 | for i in range(tries): | ||
17 | try: | ||
18 | r = urllib.request.urlopen(url) | ||
19 | if r.code == 200: | ||
20 | connected = True | ||
21 | break | ||
22 | else: | ||
23 | print('Bad return code from server ' + url + ': ' + str(r.code) + | ||
24 | ' (attempt ' + str(i + 1) + ' of ' + str(tries) + ')') | ||
25 | except urllib.error.URLError as e: | ||
26 | print('Error connecting to server ' + url + ': ' + str(e) + | ||
27 | ' (attempt ' + str(i + 1) + ' of ' + str(tries) + ')') | ||
28 | if not connected: | ||
16 | return | 29 | return |
17 | resp = r.read().decode('utf-8') | 30 | resp = r.read().decode('utf-8') |
18 | j = json.loads(resp) | 31 | j = json.loads(resp) |