diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2017-07-20 03:44:29 -0400 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-07-24 18:58:53 +0200 |
commit | 6e445ba8291d58f20e6a6b61afeabed85bd7b953 (patch) | |
tree | d996994aed8466e2c5005119b5143f8aefdc4f3c /meta-python/recipes-extended/python-pykickstart/files/0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch | |
parent | baa7758845df8c6adc445ace7c025f691a243d31 (diff) | |
download | meta-openembedded-6e445ba8291d58f20e6a6b61afeabed85bd7b953.tar.gz |
python3-pykickstart: add recipe 2.35
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-python/recipes-extended/python-pykickstart/files/0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch')
-rw-r--r-- | meta-python/recipes-extended/python-pykickstart/files/0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/meta-python/recipes-extended/python-pykickstart/files/0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch b/meta-python/recipes-extended/python-pykickstart/files/0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch new file mode 100644 index 0000000000..cb21235460 --- /dev/null +++ b/meta-python/recipes-extended/python-pykickstart/files/0002-pykickstart-parser.py-add-lock-for-readKickstart-and.patch | |||
@@ -0,0 +1,76 @@ | |||
1 | From e6e747b883114bfad51ad93f823e65f5a4d6438a Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 1 Jun 2017 15:12:29 +0800 | ||
4 | Subject: [PATCH 2/4] pykickstart/parser.py: add lock for readKickstart and | ||
5 | support https without certification | ||
6 | |||
7 | - Add lock for readKickstart to fix race issue | ||
8 | |||
9 | - Support to download kickstart file through https without certification | ||
10 | |||
11 | Upstream-Status: Inappropriate[oe specific] | ||
12 | |||
13 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
14 | --- | ||
15 | pykickstart/load.py | 2 +- | ||
16 | pykickstart/parser.py | 24 ++++++++++++++++++++++++ | ||
17 | 2 files changed, 25 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/pykickstart/load.py b/pykickstart/load.py | ||
20 | index 0f5741b..48c8276 100644 | ||
21 | --- a/pykickstart/load.py | ||
22 | +++ b/pykickstart/load.py | ||
23 | @@ -30,7 +30,7 @@ from requests.exceptions import SSLError, RequestException | ||
24 | |||
25 | _is_url = lambda location: '://' in location # RFC 3986 | ||
26 | |||
27 | -SSL_VERIFY = True | ||
28 | +SSL_VERIFY = False | ||
29 | |||
30 | def load_to_str(location, user=None, passwd=None): | ||
31 | '''Load a destination URL or file into a string. | ||
32 | diff --git a/pykickstart/parser.py b/pykickstart/parser.py | ||
33 | index 26b5de9..264ba05 100644 | ||
34 | --- a/pykickstart/parser.py | ||
35 | +++ b/pykickstart/parser.py | ||
36 | @@ -57,6 +57,26 @@ STATE_COMMANDS = "commands" | ||
37 | |||
38 | ver = version.DEVEL | ||
39 | |||
40 | +import logging | ||
41 | +log = logging.getLogger("anaconda") | ||
42 | + | ||
43 | +import inspect | ||
44 | +import threading | ||
45 | +_private_ks_lock = threading.RLock() | ||
46 | + | ||
47 | +class KsLock(object): | ||
48 | + def __enter__(self): | ||
49 | + log.info("%s %s" % (self.__class__.__name__, inspect.stack()[0][3])) | ||
50 | + _private_ks_lock.acquire() | ||
51 | + return _private_ks_lock | ||
52 | + | ||
53 | + def __exit__(self, exc_type, exc_val, exc_tb): | ||
54 | + log.info("%s %s" % (self.__class__.__name__, inspect.stack()[0][3])) | ||
55 | + _private_ks_lock.release() | ||
56 | + | ||
57 | + | ||
58 | +_ks_lock = KsLock() | ||
59 | + | ||
60 | def _preprocessStateMachine (lineIter): | ||
61 | l = None | ||
62 | lineno = 0 | ||
63 | @@ -774,6 +794,10 @@ class KickstartParser(object): | ||
64 | self._stateMachine (i) | ||
65 | |||
66 | def readKickstart(self, f, reset=True, username=None, password=None): | ||
67 | + with _ks_lock: | ||
68 | + self._readKickstart(f, reset=reset, username=username, password=password) | ||
69 | + | ||
70 | + def _readKickstart(self, f, reset=True, username=None, password=None): | ||
71 | """Process a kickstart file, given by the filename f.""" | ||
72 | if reset: | ||
73 | self._reset() | ||
74 | -- | ||
75 | 2.7.4 | ||
76 | |||