diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2018-08-01 15:21:39 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2018-08-02 11:23:03 -0700 |
commit | 4c61e30cfb965d260fc0cd5339a3a7c8e781eac2 (patch) | |
tree | 0a6376d8b95c362088544d1b0aaf73ffd7bc0e22 /meta-python/recipes-extended/python-pykickstart/files/0004-load.py-retry-to-invoke-request-with-timeout.patch | |
parent | f38ff38f48468a4505ed6396e832d2574d7914d7 (diff) | |
download | meta-openembedded-4c61e30cfb965d260fc0cd5339a3a7c8e781eac2.tar.gz |
python3-pykickstart: 2.35 -> 3.15
- Rebase 0001 ~ 0004
- Drop 0005-tweak-shebang-to-python3.patch
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python/recipes-extended/python-pykickstart/files/0004-load.py-retry-to-invoke-request-with-timeout.patch')
-rw-r--r-- | meta-python/recipes-extended/python-pykickstart/files/0004-load.py-retry-to-invoke-request-with-timeout.patch | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/meta-python/recipes-extended/python-pykickstart/files/0004-load.py-retry-to-invoke-request-with-timeout.patch b/meta-python/recipes-extended/python-pykickstart/files/0004-load.py-retry-to-invoke-request-with-timeout.patch index 70254f6fda..c950be6389 100644 --- a/meta-python/recipes-extended/python-pykickstart/files/0004-load.py-retry-to-invoke-request-with-timeout.patch +++ b/meta-python/recipes-extended/python-pykickstart/files/0004-load.py-retry-to-invoke-request-with-timeout.patch | |||
@@ -1,6 +1,6 @@ | |||
1 | From c0e63f0d3c09bdabb0ad2c88b7cc73e7618dd86a Mon Sep 17 00:00:00 2001 | 1 | From a86ba22d7133199d850ef3d893571f27d6b0faed Mon Sep 17 00:00:00 2001 |
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
3 | Date: Thu, 15 Jun 2017 17:35:33 +0800 | 3 | Date: Mon, 30 Jul 2018 15:52:21 +0800 |
4 | Subject: [PATCH 4/4] load.py: retry to invoke request with timeout | 4 | Subject: [PATCH 4/4] load.py: retry to invoke request with timeout |
5 | 5 | ||
6 | While networkless, use request to fetch kickstart file from | 6 | While networkless, use request to fetch kickstart file from |
@@ -12,11 +12,11 @@ Upstream-Status: inappropriate [oe specific] | |||
12 | 12 | ||
13 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | 13 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
14 | --- | 14 | --- |
15 | pykickstart/load.py | 30 ++++++++++++++++++++++++++++++ | 15 | pykickstart/load.py | 31 +++++++++++++++++++++++++++++++ |
16 | 1 file changed, 30 insertions(+) | 16 | 1 file changed, 31 insertions(+) |
17 | 17 | ||
18 | diff --git a/pykickstart/load.py b/pykickstart/load.py | 18 | diff --git a/pykickstart/load.py b/pykickstart/load.py |
19 | index 48c8276..74b266b 100644 | 19 | index 7adb751..b62245e 100644 |
20 | --- a/pykickstart/load.py | 20 | --- a/pykickstart/load.py |
21 | +++ b/pykickstart/load.py | 21 | +++ b/pykickstart/load.py |
22 | @@ -21,6 +21,7 @@ import requests | 22 | @@ -21,6 +21,7 @@ import requests |
@@ -32,12 +32,12 @@ index 48c8276..74b266b 100644 | |||
32 | from requests.exceptions import SSLError, RequestException | 32 | from requests.exceptions import SSLError, RequestException |
33 | 33 | ||
34 | +import logging | 34 | +import logging |
35 | +log = logging.getLogger("anaconda") | 35 | +log = logging.getLogger("anaconda.main") |
36 | + | 36 | + |
37 | _is_url = lambda location: '://' in location # RFC 3986 | 37 | _is_url = lambda location: '://' in location # RFC 3986 |
38 | 38 | ||
39 | SSL_VERIFY = False | 39 | SSL_VERIFY = False |
40 | @@ -74,6 +78,29 @@ def load_to_file(location, destination): | 40 | @@ -73,6 +77,29 @@ def load_to_file(location, destination): |
41 | _copy_file(location, destination) | 41 | _copy_file(location, destination) |
42 | return destination | 42 | return destination |
43 | 43 | ||
@@ -67,16 +67,17 @@ index 48c8276..74b266b 100644 | |||
67 | def _get_auth(location, user=None, passwd=None): | 67 | def _get_auth(location, user=None, passwd=None): |
68 | 68 | ||
69 | auth = None | 69 | auth = None |
70 | @@ -96,6 +123,9 @@ def _get_auth(location, user=None, passwd=None): | 70 | @@ -94,6 +121,10 @@ def _get_auth(location, user=None, passwd=None): |
71 | def _load_url(location, user=None, passwd=None): | ||
72 | '''Load a location (URL or filename) and return contents as string''' | ||
73 | 71 | ||
72 | def _load_url(location, user=None, passwd=None): | ||
73 | '''Load a location (URL or filename) and return contents as string''' | ||
74 | + | ||
74 | + if not _access_url(location): | 75 | + if not _access_url(location): |
75 | + raise KickstartError(_("Connection %s failed" % location)) | 76 | + raise KickstartError(_("Connection %s failed" % location)) |
76 | + | 77 | + |
77 | auth = _get_auth(location, user=user, passwd=passwd) | 78 | auth = _get_auth(location, user=user, passwd=passwd) |
78 | |||
79 | try: | 79 | try: |
80 | request = requests.get(location, verify=SSL_VERIFY, auth=auth) | ||
80 | -- | 81 | -- |
81 | 2.7.4 | 82 | 2.7.4 |
82 | 83 | ||