Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [BUG]: Ensure postgresql storage subdirectory exists fails if volume matches current setup #24

Closed
paddyroddy opened this issue Dec 15, 2023 · 5 comments
Labels
problem Something isn't working

Comments

@paddyroddy
Copy link
Member

Bug Description

With external_storage_drive: /storage/xnat

When I use this collection. This step fails:

- name: Ensure postgresql storage subdirectory exists
ansible.builtin.file:
path: "{{ postgresql_storage.storage_directory }}"
owner: "{{ postgresql.owner }}"
group: "{{ postgresql.group }}"
state: directory
mode: "0700"

If, like you, I have https://github.com/UCL-MIRSG/ansible-collection-xnat/blob/4b3975734c4736ea9de2950a55037dc411643e30/tests/molecule/rocky9/molecule.yml#L23 of the form ./xnat-data:/storage/xnat, but works if it is ./xnat-data/xnat:/storage/xnat.

When the mirsg.install_xnat failed, I got onto the xnat_db container and wasn't able to make ny file or folder in /storage/xnat, however I could at the /storage level. This is likely because mkdir isn't recursive, you have to have the -p flag (@razekmh helped me debug this).

Can you look into either fixing this task step or change your https://github.com/UCL-MIRSG/ansible-collection-xnat/blob/main/tests/molecule/rocky9/molecule.yml - not sure how it is working for you currently.

Steps to Reproduce

Acceptance Criteria

Related Work Items

Preview Give feedback
No tasks being tracked yet.
@paddyroddy paddyroddy added the problem Something isn't working label Dec 15, 2023
@razekmh
Copy link

razekmh commented Dec 15, 2023

Maybe using recurse would resolve the issue.

 - name: Ensure postgresql storage subdirectory exists 
   ansible.builtin.file: 
     path: "{{ postgresql_storage.storage_directory }}" 
     owner: "{{ postgresql.owner }}" 
     group: "{{ postgresql.group }}" 
     state: directory 
     mode: "0700"
     recurse: true

@paddyroddy
Copy link
Member Author

@p-j-smith: Huh, where is your configuration? And what's the error you get?

With this in my docker-compose

    volumes:
      - ./xnat-data:/storage/xnat

error

srr-ansible-1   | TASK [mirsg.infrastructure.postgresql : Ensure postgresql storage subdirectory exists] ***
srr-ansible-1   | fatal: [xnat_db]: FAILED! => {"changed": false, "msg": "There was an issue creating /storage/xnat/pgsql as requested: [Errno 2] No such file or directory: b'/storage/xnat/pgsql'", "path": "/storage/xnat/pgsql"}

If I change the volume to

    volumes:
      - ./xnat-data:/storage/xnat

then I get past that step

@p-j-smith
Copy link
Contributor

I think this might be related to another issue you were having with postgres, which was fixed by adding:

${USERNAME} ALL=\(ALL\) NOPASSWD:ALL

to your dockerfile. Since this change, I can't replicate the error you've reported here

@paddyroddy
Copy link
Member Author

I think this might be related to another issue you were having with postgres, which was fixed by adding:

${USERNAME} ALL=\(ALL\) NOPASSWD:ALL

to your dockerfile. Since this change, I can't replicate the error you've reported here

That is unrelated

@paddyroddy
Copy link
Member Author

@p-j-smith spotted that my IP address was wrong for xnat_web. Fixing that, was enough for the problem to be solved 🤔 sorry for the noise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants