... | ... |
@@ -36,6 +36,10 @@ import os |
36 | 36 |
import sys |
37 | 37 |
import traceback |
38 | 38 |
|
39 |
+# for debug |
|
40 |
+from multiprocessing import Lock |
|
41 |
+debug_lock = Lock() |
|
42 |
+ |
|
39 | 43 |
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError |
40 | 44 |
from ansible.utils.display import Display |
41 | 45 |
from ansible.utils.unicode import to_unicode |
... | ... |
@@ -31,7 +31,6 @@ import getpass |
31 | 31 |
import errno |
32 | 32 |
from struct import unpack, pack |
33 | 33 |
from termios import TIOCGWINSZ |
34 |
-from multiprocessing import Lock |
|
35 | 34 |
|
36 | 35 |
from ansible import constants as C |
37 | 36 |
from ansible.errors import AnsibleError |
... | ... |
@@ -39,15 +38,21 @@ from ansible.utils.color import stringc |
39 | 39 |
from ansible.utils.unicode import to_bytes, to_unicode |
40 | 40 |
|
41 | 41 |
try: |
42 |
+ from __main__ import debug_lock |
|
43 |
+except ImportError: |
|
44 |
+ # for those not using a CLI, though ... |
|
45 |
+ # this might not work well after fork |
|
46 |
+ from multiprocessing import Lock |
|
47 |
+ debug_lock = Lock() |
|
48 |
+ |
|
49 |
+try: |
|
42 | 50 |
# Python 2 |
43 | 51 |
input = raw_input |
44 | 52 |
except NameError: |
45 |
- # Python 3 |
|
53 |
+ # Python 3, we already have raw_input |
|
46 | 54 |
pass |
47 | 55 |
|
48 | 56 |
|
49 |
-# These are module level as we currently fork and serialize the whole process and locks in the objects don't play well with that |
|
50 |
-debug_lock = Lock() |
|
51 | 57 |
|
52 | 58 |
logger = None |
53 | 59 |
#TODO: make this a logging callback instead |