Add option for `files_external:import` to overwrite existing mounts (with the same `mount_id`)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
The Problem
I'm running a CI/CD pipeline for a NextCloud server. I have some external mounts defined as JSON files to keep them under version control. I'd like to automatically re-mount these external mounts again on successive deployments with the same mount_id so that all users the mounts are shared to see the updates.
The JSON files have a specified mount_id, and importing with the --dry option shows that this mount_id is indeed read correctly, however if these mount_ids are already in use, it imports them as new mounts. As much as I've looked there is no easy way to overwrite existing mounts on import, without truncating the database table, which seems a bit hacky.
Possible Solutions
Perhaps the files_external:import should offer a --force option that overwrites an existing mount if it exists?
Workaround
The workaround I'm currently using is first checking if the mounts exist, and if they do, instead of importing, I call :option and :config for all the fields. This however is incomplete as some things cannot be changed, such as the mount point, the authentication method and the type of mount (SMB, Dav, etc...)
Context
Using NextCloud 25.0.1 and MariaDB database. I'm persisting the database upon successive deployments, but I overwrite certain configurations on each deployment.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the files_external:import command and its external-mount import path. Reproduce the JSON import with an existing mount_id, then define done as an option that replaces the existing mount rather than creating a duplicate, including the fields the current workaround cannot change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100