Skip to content

chown the definitions to the rabbit user after our script edits them#3735

Open
MoralCode wants to merge 1 commit intomainfrom
fix/rabbit_build_permissions
Open

chown the definitions to the rabbit user after our script edits them#3735
MoralCode wants to merge 1 commit intomainfrom
fix/rabbit_build_permissions

Conversation

@MoralCode
Copy link
Contributor

Description

  • This makes a small adjustment to our container build order for rabbitmq such that the permissions are changed after our script that adjusts rabbit config is run

This PR fixes #3734

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
@MoralCode MoralCode added the containers Related to augur in containers, container images, or the compose file, either in podman or in docker label Feb 24, 2026

RUN exec python3 update_config.py

RUN chown rabbitmq:rabbitmq /etc/rabbitmq/definitions.json
Copy link
Member

Choose a reason for hiding this comment

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

If the issue is that update_config.py cannot write to definitions.json ... just trying to wrap my head around whether or not this "should" work.

Given this error:

PermissionError: [Errno 13] Permission denied: '/etc/rabbitmq/definitions.json'
Error: building at STEP "RUN exec python3 update_config.py": while running runtime: exit status 

it would seem like /etc/rabbitmq, if owned by the rabbitmq user, would then allow for the definitions.json file to be written.

I have not tested this, just thinking about the logic I see, @MoralCode .

Copy link
Member

Choose a reason for hiding this comment

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

It would again seem to me that changing permissions on a file that can't be written won't work ... but this may be something I don't understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What are you asking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the file can't be written due to permissions issues adjusting the permissions seems like it would help

Copy link
Member

Choose a reason for hiding this comment

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

Does the file already exist though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's in the same folder as the Dockerfile. I think one of the previous Dockerfile steps is that we copy the file into the container before we run this script to make the final adjustments to it.

The problem here is essentially that if we run this chown line before we run the script that changes the file, we change the permissions such that the script can no longer edit the file, causing the crash.

I still need to run some builds with this new ordering of the build steps to make sure that the problem goes away, but I'm pretty confident that this is what's happening.

@MoralCode
Copy link
Contributor Author

can confirm this fixes the build on my machine. will run it while testing other stuff to make sure rabbit behavior is unchanged as anticipated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

containers Related to augur in containers, container images, or the compose file, either in podman or in docker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

podman: Rabbit config update script doesnt have permissions to modify the config file

2 participants