Skip to content

Commit

Permalink
subp: add a log when skipping a file for execution for lack of exe pe…
Browse files Browse the repository at this point in the history
…rmission (#4506)

Sometimes a script may itself have executable permission but the underlying
file system on which the script is located may have been mounted with 'noexec'
mount option. On those cases is_exe() would return false and the file would
be silently skipped. Add a warning log when a file is being skipped so that
it can be noticed and provides useful information while debugging issues.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
  • Loading branch information
ani-sinha authored Oct 18, 2023
1 parent 7377c77 commit 9a401b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cloudinit/subp.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ def runparts(dirp, skip_no_exist=True, exe_prefix=None):
except ProcessExecutionError as e:
LOG.debug(e)
failed.append(exe_name)
else:
LOG.warning(
"skipping %s as its not executable "
"or the underlying file system is mounted without "
"executable permissions.",
exe_path,
)

if failed and attempted:
raise RuntimeError(
Expand Down

0 comments on commit 9a401b4

Please sign in to comment.