galaxyproject / ansible-cvmfs

An Ansible role for installing and configuring CernVM-FS (CVMFS)
12 stars 17 forks source link

Fix role failing on Squid task "Create the cache directories for the first time" #61

Closed kysrpex closed 1 year ago

kysrpex commented 1 year ago

Squid cannot be launched if it is already running. If the role has been run at least once, then Squid will fail to execute during the "Create the cache directories for the first time" task, causing the whole role to fail.

This PR changes the behavior of the role so that it tries to create the cache directories only if they do not exist. In addition, it ensures Squid is not running before trying to do so.

hexylena commented 1 year ago

This seems odd, it should only break if the directories had not been created? In which case you ran the role far enough to get a running squid, but somehow failed to create the directories? How did you get in such a situation?

kysrpex commented 1 year ago

Squid was running from a previous role execution, the directories did already exist. The role launches squid to create the directories without checking if they already exist, and squid fails to launch because it detects that it is already running.

As far as I know, the role does not stop squid before attempting to create the cache directories right? How is it then supposed not to fail?

I think usegalaxy.org is using the in-memory cache and maybe this is why this may have gone under the radar.

hexylena commented 1 year ago

The role launches squid to create the directories without checking if they already exist

err, that's incorrect.

https://github.com/galaxyproject/ansible-cvmfs/pull/61/files#diff-f1cb3e8668c3ddb1a346644ae92a4e8aede26fe4c1d71c41d42aa877004c8d51L26 creates will not run an action if it has already been run. See the docs for args: creates which is both under args and command.

kysrpex commented 1 year ago

The role launches squid to create the directories without checking if they already exist

err, that's incorrect.

https://github.com/galaxyproject/ansible-cvmfs/pull/61/files#diff-f1cb3e8668c3ddb1a346644ae92a4e8aede26fe4c1d71c41d42aa877004c8d51L26 creates will not run an action if it has already been run. See the docs for args: creates which is both under args and command.

Thanks, I did not know that and it looks very useful! Now it is clear to me where the problem is.