File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -367,10 +367,15 @@ def _setup_cwd(self):
367
367
"""
368
368
For situations like sudo to a non-privileged account, CWD could be
369
369
$HOME of the old account, which could have mode go=, which means it is
370
- impossible to restore the old directory, so don't even try .
370
+ impossible to restore the old directory. Fallback to a neutral temp if so .
371
371
"""
372
372
if self .cwd :
373
- os .chdir (self .cwd )
373
+ try :
374
+ os .chdir (self .cwd )
375
+ except OSError :
376
+ LOG .debug ('%r: could not CHDIR to %r fallback to %r' ,
377
+ self , self .cwd , self .good_temp_dir )
378
+ os .chdir (self .good_temp_dir )
374
379
375
380
def _setup_environ (self ):
376
381
"""
Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ v0.3.9 (2024-08-13)
198
198
v0.3.8 (2024-07-30)
199
199
-------------------
200
200
201
+ * :gh:issue: `636 ` os.chdir fails if the sudo/become user lacks adequate permissions to chdir prior to task
201
202
* :gh:issue: `952 ` Fix Ansible `--ask-become-pass `, add test coverage
202
203
* :gh:issue: `957 ` Fix Ansible exception when executing against 10s of hosts
203
204
"ValueError: filedescriptor out of range in select()"
You can’t perform that action at this time.
0 commit comments