Skip to content

Conversation

jk464
Copy link
Contributor

@jk464 jk464 commented Nov 27, 2023

Fixes #5591.

For local-shell-script runners, the runner tries to ensure the script_action is executable by running:

        if script_action:
            script_local_path_abs = self.entry_point
            args = "chmod +x %s ; %s" % (script_local_path_abs, args)
            sanitized_args = "chmod +x %s ; %s" % (
                script_local_path_abs,
                sanitized_args,
            )

On readonly filesystems, such as when StackStorm is deployed in HA on Kubernetes - this chmod +x command fails:

stderr: "chmod: changing permissions of '/opt/stackstorm/packs/ansible/actions/ansible.py': Read-only file system

(Note since this command isn't && with the actual action, that still runs fine - there's just an error logged in the action output)

This is fixed, by only running this block if the filesystem is read-writeable - by adding the following to the conditional check:

bool(os.statvfs(self.entry_point).f_flag & os.ST_RDONLY)

Which returns True if the filesystem that self.entry_point (which is the script that will attemped to be chmod +x'ed) is on is readonly, and False otherwise.

This fix maintains functionally where there this worked previously (read-writeable fs), while fixing the bug on readonly fs. As per my comment on #5591, I think we should just drop this block all together - but that could be a change in 3.9.0 - for now this fixes the bug without changing anything else. :)

@pull-request-size pull-request-size bot added the size/XS PR that changes 0-9 lines. Quick fix/merge. label Nov 27, 2023
@arm4b arm4b added this to the 3.8.1 milestone Nov 27, 2023
@arm4b arm4b added bug HA StackStorm in High Availability labels Nov 27, 2023
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the fix!

@arm4b arm4b enabled auto-merge November 27, 2023 12:47
@arm4b arm4b merged commit 80cd7bc into StackStorm:master Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug HA StackStorm in High Availability size/XS PR that changes 0-9 lines. Quick fix/merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"local-shell-script" does not work on read only file systems
3 participants