diff options
author | Wang Mingyu <wangmy@fujitsu.com> | 2023-02-11 21:33:22 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-02-12 08:56:16 -0800 |
commit | 21a69c4c90303e334cf0679251c82c8035afb32d (patch) | |
tree | 47b62ccc76e9741458c414221899ee4afa5b96dc /meta-python/recipes-extended/python-pykickstart/files/0001-support-authentication-for-kickstart.patch | |
parent | de0bda3f7e8a27ce4e8644a7c430126489517fd2 (diff) | |
download | meta-openembedded-21a69c4c90303e334cf0679251c82c8035afb32d.tar.gz |
python3-pykickstart: upgrade 3.34 -> 3.43
0001-support-authentication-for-kickstart.patch
0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch
0004-load.py-retry-to-invoke-request-with-timeout.patch
refreshed for new version.
Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python/recipes-extended/python-pykickstart/files/0001-support-authentication-for-kickstart.patch')
-rw-r--r-- | meta-python/recipes-extended/python-pykickstart/files/0001-support-authentication-for-kickstart.patch | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/meta-python/recipes-extended/python-pykickstart/files/0001-support-authentication-for-kickstart.patch b/meta-python/recipes-extended/python-pykickstart/files/0001-support-authentication-for-kickstart.patch index 5f95d74bf1..23a06bf622 100644 --- a/meta-python/recipes-extended/python-pykickstart/files/0001-support-authentication-for-kickstart.patch +++ b/meta-python/recipes-extended/python-pykickstart/files/0001-support-authentication-for-kickstart.patch | |||
@@ -12,15 +12,14 @@ which the invoker could parse this specific error. | |||
12 | Upstream-Status: inappropriate [oe specific] | 12 | Upstream-Status: inappropriate [oe specific] |
13 | 13 | ||
14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | 14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
15 | |||
16 | --- | 15 | --- |
17 | pykickstart/errors.py | 17 +++++++++++++++++ | 16 | pykickstart/errors.py | 17 +++++++++++++++++ |
18 | pykickstart/load.py | 34 ++++++++++++++++++++++++++++------ | 17 | pykickstart/load.py | 32 +++++++++++++++++++++++++++----- |
19 | pykickstart/parser.py | 4 ++-- | 18 | pykickstart/parser.py | 4 ++-- |
20 | 3 files changed, 47 insertions(+), 8 deletions(-) | 19 | 3 files changed, 46 insertions(+), 7 deletions(-) |
21 | 20 | ||
22 | diff --git a/pykickstart/errors.py b/pykickstart/errors.py | 21 | diff --git a/pykickstart/errors.py b/pykickstart/errors.py |
23 | index 8294f59a..3d20bf82 100644 | 22 | index 8294f59..3d20bf8 100644 |
24 | --- a/pykickstart/errors.py | 23 | --- a/pykickstart/errors.py |
25 | +++ b/pykickstart/errors.py | 24 | +++ b/pykickstart/errors.py |
26 | @@ -32,6 +32,9 @@ This module exports several exception classes: | 25 | @@ -32,6 +32,9 @@ This module exports several exception classes: |
@@ -52,16 +51,15 @@ index 8294f59a..3d20bf82 100644 | |||
52 | + def __str__(self): | 51 | + def __str__(self): |
53 | + return self.value | 52 | + return self.value |
54 | diff --git a/pykickstart/load.py b/pykickstart/load.py | 53 | diff --git a/pykickstart/load.py b/pykickstart/load.py |
55 | index 30e2fcfa..b984876d 100644 | 54 | index eb76b65..f51cf08 100644 |
56 | --- a/pykickstart/load.py | 55 | --- a/pykickstart/load.py |
57 | +++ b/pykickstart/load.py | 56 | +++ b/pykickstart/load.py |
58 | @@ -18,9 +18,12 @@ | 57 | @@ -18,9 +18,11 @@ |
59 | # with the express permission of Red Hat, Inc. | 58 | # with the express permission of Red Hat, Inc. |
60 | # | 59 | # |
61 | import requests | 60 | import requests |
62 | +from requests.auth import HTTPDigestAuth | 61 | +from requests.auth import HTTPDigestAuth |
63 | +from requests.auth import HTTPBasicAuth | 62 | +from requests.auth import HTTPBasicAuth |
64 | + | ||
65 | import shutil | 63 | import shutil |
66 | 64 | ||
67 | -from pykickstart.errors import KickstartError | 65 | -from pykickstart.errors import KickstartError |
@@ -69,7 +67,7 @@ index 30e2fcfa..b984876d 100644 | |||
69 | from pykickstart.i18n import _ | 67 | from pykickstart.i18n import _ |
70 | from requests.exceptions import SSLError, RequestException | 68 | from requests.exceptions import SSLError, RequestException |
71 | 69 | ||
72 | @@ -28,7 +31,7 @@ _is_url = lambda location: '://' in location # RFC 3986 | 70 | @@ -28,7 +30,7 @@ is_url = lambda location: '://' in location # RFC 3986 |
73 | 71 | ||
74 | SSL_VERIFY = True | 72 | SSL_VERIFY = True |
75 | 73 | ||
@@ -78,21 +76,20 @@ index 30e2fcfa..b984876d 100644 | |||
78 | '''Load a destination URL or file into a string. | 76 | '''Load a destination URL or file into a string. |
79 | Type of input is inferred automatically. | 77 | Type of input is inferred automatically. |
80 | 78 | ||
81 | @@ -39,7 +42,7 @@ def load_to_str(location): | 79 | @@ -39,7 +41,7 @@ def load_to_str(location): |
82 | Raises: KickstartError on error reading''' | 80 | Raises: KickstartError on error reading''' |
83 | 81 | ||
84 | if _is_url(location): | 82 | if is_url(location): |
85 | - return _load_url(location) | 83 | - return _load_url(location) |
86 | + return _load_url(location, user=user, passwd=passwd) | 84 | + return _load_url(location, user=user, passwd=passwd) |
87 | else: | 85 | else: |
88 | return _load_file(location) | 86 | return _load_file(location) |
89 | 87 | ||
90 | @@ -69,11 +72,30 @@ def load_to_file(location, destination): | 88 | @@ -69,11 +71,31 @@ def load_to_file(location, destination): |
91 | _copy_file(location, destination) | 89 | _copy_file(location, destination) |
92 | return destination | 90 | return destination |
93 | 91 | ||
94 | -def _load_url(location): | 92 | -def _load_url(location): |
95 | - '''Load a location (URL or filename) and return contents as string''' | ||
96 | +def _get_auth(location, user=None, passwd=None): | 93 | +def _get_auth(location, user=None, passwd=None): |
97 | + | 94 | + |
98 | + auth = None | 95 | + auth = None |
@@ -101,7 +98,7 @@ index 30e2fcfa..b984876d 100644 | |||
101 | + if user is None or passwd is None: | 98 | + if user is None or passwd is None: |
102 | + log.info("Require Authentication") | 99 | + log.info("Require Authentication") |
103 | + raise KickstartAuthError("Require Authentication.\nAppend 'ksuser=<username> kspasswd=<password>' to boot command") | 100 | + raise KickstartAuthError("Require Authentication.\nAppend 'ksuser=<username> kspasswd=<password>' to boot command") |
104 | 101 | + | |
105 | + reasons = request.headers.get("WWW-Authenticate", "").split() | 102 | + reasons = request.headers.get("WWW-Authenticate", "").split() |
106 | + if reasons: | 103 | + if reasons: |
107 | + auth_type = reasons[0] | 104 | + auth_type = reasons[0] |
@@ -113,8 +110,9 @@ index 30e2fcfa..b984876d 100644 | |||
113 | + return auth | 110 | + return auth |
114 | + | 111 | + |
115 | +def _load_url(location, user=None, passwd=None): | 112 | +def _load_url(location, user=None, passwd=None): |
116 | + '''Load a location (URL or filename) and return contents as string''' | 113 | '''Load a location (URL or filename) and return contents as string''' |
117 | + auth = _get_auth(location, user=user, passwd=passwd) | 114 | + auth = _get_auth(location, user=user, passwd=passwd) |
115 | |||
118 | try: | 116 | try: |
119 | - request = requests.get(location, verify=SSL_VERIFY) | 117 | - request = requests.get(location, verify=SSL_VERIFY) |
120 | + request = requests.get(location, verify=SSL_VERIFY, auth=auth) | 118 | + request = requests.get(location, verify=SSL_VERIFY, auth=auth) |
@@ -122,10 +120,10 @@ index 30e2fcfa..b984876d 100644 | |||
122 | raise KickstartError(_('Error securely accessing URL "%s"') % location + ': {e}'.format(e=str(e))) | 120 | raise KickstartError(_('Error securely accessing URL "%s"') % location + ': {e}'.format(e=str(e))) |
123 | except RequestException as e: | 121 | except RequestException as e: |
124 | diff --git a/pykickstart/parser.py b/pykickstart/parser.py | 122 | diff --git a/pykickstart/parser.py b/pykickstart/parser.py |
125 | index b23e54f1..e10f06b5 100644 | 123 | index 7edf8aa..46c5299 100644 |
126 | --- a/pykickstart/parser.py | 124 | --- a/pykickstart/parser.py |
127 | +++ b/pykickstart/parser.py | 125 | +++ b/pykickstart/parser.py |
128 | @@ -796,7 +796,7 @@ class KickstartParser(object): | 126 | @@ -790,7 +790,7 @@ class KickstartParser(object): |
129 | i = PutBackIterator(s.splitlines(True) + [""]) | 127 | i = PutBackIterator(s.splitlines(True) + [""]) |
130 | self._stateMachine(i) | 128 | self._stateMachine(i) |
131 | 129 | ||
@@ -134,7 +132,7 @@ index b23e54f1..e10f06b5 100644 | |||
134 | """Process a kickstart file, given by the filename f.""" | 132 | """Process a kickstart file, given by the filename f.""" |
135 | if reset: | 133 | if reset: |
136 | self._reset() | 134 | self._reset() |
137 | @@ -817,7 +817,7 @@ class KickstartParser(object): | 135 | @@ -811,7 +811,7 @@ class KickstartParser(object): |
138 | self.currentdir[self._includeDepth] = cd | 136 | self.currentdir[self._includeDepth] = cd |
139 | 137 | ||
140 | try: | 138 | try: |
@@ -143,3 +141,6 @@ index b23e54f1..e10f06b5 100644 | |||
143 | except KickstartError as e: | 141 | except KickstartError as e: |
144 | raise KickstartError(_("Unable to open input kickstart file: %s") % str(e), lineno=0) | 142 | raise KickstartError(_("Unable to open input kickstart file: %s") % str(e), lineno=0) |
145 | 143 | ||
144 | -- | ||
145 | 2.34.1 | ||
146 | |||