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

Create uploads folder automatically #6

Closed
kysrpex opened this issue Aug 25, 2023 · 7 comments · Fixed by #8
Closed

Create uploads folder automatically #6

kysrpex opened this issue Aug 25, 2023 · 7 comments · Fixed by #8
Assignees
Labels
enhancement New feature or request

Comments

@kysrpex
Copy link
Contributor

kysrpex commented Aug 25, 2023

@sanjaysrikakulam wrote:

[...] it would be nice if the role could ensure or check that the upload folders listed or mentioned in the playbook actually exist and if not it would be nice if the role can create it

@kysrpex kysrpex added the enhancement New feature or request label Aug 25, 2023
@kysrpex
Copy link
Contributor Author

kysrpex commented Aug 25, 2023

What variable is that, rustus_instances.working_directory? I am asking because the working directory is not necessarily the uploads directory. Just let me know exactly what folder should be created.

@sanjaysrikakulam
Copy link
Member

The values mentioned for the variables upload_dir_test, upload_dir_main, example here.

If these folders or paths do not exist, the service won't start. Also, the role does not fail when this happens. It would be nice if the role creates these folders when they do not exist or at least add a variable-based task; if that variable (create_upload_dirs) is enabled, then the required/requested folders should be created or something like that.

@kysrpex
Copy link
Contributor Author

kysrpex commented Aug 28, 2023

Ok, I get it now. The thing is that the role is unaware of how will you use it. It does not know that you have defined two variables upload_dir_test and upload_dir_main. I think (take this with a pinch of salt though) that rustus tries to save uploads to its working directory unless you specify a different path via command line argument.

If indeed, rustus tries to put uploads in its working directory, I think the closest equivalent of what you want would be to have the role ensure working_directory exists.

Of course, the role could be tailored to our specific use case and an upload_dir variable, but then it becomes unfit for other use cases (e.g. S3 storage).

Regardless of what we do, we can find out how to make the role fail appropriately when working_directory does not exist in #7.

Do you want the role to ensure working_directory exists?

@sanjaysrikakulam
Copy link
Member

Yes, I was talking more about the working_directory variable rather than the upload_dir_test, and upload_dir_main. I did not notice the exact variable name for that in the playbook (so I mentioned the values used by those two variable), I just assumed it'd be obvious (my bad :().

It would be nice to have a variable asking whether the working_directory should be created and if it's set to true (default: false) the role checks it (just in case) and creates the working directory.

@kysrpex
Copy link
Contributor Author

kysrpex commented Aug 28, 2023

That is a perfect solution :) I'll do that.

@sanjaysrikakulam
Copy link
Member

Cool, thank you!

@kysrpex kysrpex self-assigned this Sep 1, 2023
@kysrpex
Copy link
Contributor Author

kysrpex commented Sep 1, 2023

It would be nice to have a variable asking whether the working_directory should be created and if it's set to true (default: false) the role checks it (just in case) and creates the working directory.

In the end I have decided to always create the working directory automatically (no extra variable).

@kysrpex kysrpex closed this as completed in #8 Sep 5, 2023
kysrpex added a commit that referenced this issue Sep 5, 2023
Create working directories for systemd units automatically if they do
not exist. Existing directories will keep their permissions intact.

Includes test coverage.

Closes #6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants