Skip to content

Conversation

@PVince81
Copy link
Contributor

@PVince81 PVince81 commented Nov 3, 2016

Description

Keep mount point visible and also ext storage config visible when
dealing with configs relating to storage backends or auth mechanisms
that were provided by an app that is currently disabled.

Introduces InvalidBackend and InvalidAuth placeholders to be able to properly pass around the StorageConfig. This makes it possible to keep the mount point visible but have it be a FailedStorage that gracefully throws StorageNotAvailableException which results in 503 Storage not available for clients.

Related Issue

Fixes #26538

Motivation and Context

See original ticket.
Basically an admin might forget to reenable storage apps for which there are existing configs.
The current code would remove the mount point completely which would cause sync clients to delete local files.

How Has This Been Tested?

  • TEST: invalid backend keeps mount point
  • TEST: sync client behavior with invalid backend
  • TEST: invalid auth keeps mount point
  • TEST: broken config is read-only in web UI (admin + personal page)
  • TEST: broken config can be deleted in web UI
  • TEST: broken config cannot be modified with CLI commands
  • TEST: broken config can be deleted with CLI commands
  • TEST: broken config cannot be exported with CLI commands, shows warning (because storage class is missing)
  • TEST: reenable storage app (ex: WND), mount point available again, sync client functions normally (no redownload)

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@owncloud/filesystem @butonic

@mention-bot
Copy link

@PVince81, thanks for your PR! By analyzing the history of the files in this pull request, we identified @icewind1991, @Xenopathic and @butonic to be potential reviewers.

@PVince81
Copy link
Contributor Author

PVince81 commented Dec 6, 2016

Rebased

@PVince81
Copy link
Contributor Author

Bringing to "development" as discussed with @pmaier1.

This will ease the migration to external storage apps. It will preserve the mount points and configs present but not editable (not editable for technical reasons), so that when the user installs the external storage app the mounts will work again.

@PVince81
Copy link
Contributor Author

Rebased.

I have tested this with the app "files_external_gdrive":

  1. Install "files_external_gdrive"
  2. Configure a GDrive mount point
  3. Access it and see that downloading work
  4. Disable the "files_external_gdrive" app
  5. Refresh web UI
  6. Check mount point
  7. Reenable app

Before the fix: web UI would crash with some errors about missing storage classes
After the fix: web UI shows the "/gdrive" mount point in red. Accessing it through Webdav returns 503 Storage not available. After reenabling the app, the mount point works again.

@jvillafanez please review

@PVince81 PVince81 force-pushed the extstorage-invalidbackendhandling branch from f4ed76a to 52fe70b Compare October 17, 2017 15:34
@PVince81
Copy link
Contributor Author

rebased, fixed tests

@PVince81 PVince81 force-pushed the extstorage-invalidbackendhandling branch from 16803d2 to 88b847f Compare November 13, 2017 09:58
@PVince81
Copy link
Contributor Author

PVince81 commented Nov 13, 2017

I've retested all cases from the first ticket.
The only missing thing is:

  • BUG: prevent exporting incomplete config from CLI when backend is not known.

@PVince81
Copy link
Contributor Author

I decided to only display a warning when listing configs on the CLI. The warning tells about how many invalid storages there are and that the admin must enable apps, else the config is incomplete.
The warning doesn't appear when exporting to JSON because we can't output to stderr directly from OutputInterface.

@PVince81
Copy link
Contributor Author

@jvillafanez second review ?

@PVince81 PVince81 force-pushed the extstorage-invalidbackendhandling branch from 88b847f to 925885b Compare November 13, 2017 10:48
@PVince81
Copy link
Contributor Author

Squashed a few unit test additions to increase coverage.

@codecov
Copy link

codecov bot commented Nov 13, 2017

Codecov Report

Merging #26539 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #26539      +/-   ##
============================================
+ Coverage     61.63%   61.65%   +0.02%     
- Complexity    17477    17482       +5     
============================================
  Files          1044     1047       +3     
  Lines         57691    57706      +15     
============================================
+ Hits          35555    35577      +22     
+ Misses        22136    22129       -7
Impacted Files Coverage Δ Complexity Δ
lib/private/Files/External/InvalidStorage.php 100% <100%> (ø) 1 <1> (?)
...private/Files/External/Service/StoragesService.php 93.06% <100%> (+0.06%) 60 <0> (+1) ⬆️
lib/public/Files/External/Auth/InvalidAuth.php 100% <100%> (ø) 1 <1> (?)
...b/public/Files/External/Backend/InvalidBackend.php 100% <100%> (ø) 2 <2> (?)
lib/public/Files/External/Backend/Backend.php 85.71% <0%> (+14.28%) 7% <0%> (ø) ⬇️
lib/private/Files/External/IdentifierTrait.php 40.9% <0%> (+18.18%) 8% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36fbfc6...cdda2f0. Read the comment docs.

@PVince81 PVince81 force-pushed the extstorage-invalidbackendhandling branch from 925885b to 8230e45 Compare November 13, 2017 10:57
@PVince81
Copy link
Contributor Author

PVince81 commented Nov 13, 2017

  • BUG: when only auth plugin is not available, the config that had it selected looks broken:

This is with SFTP and keypair, but I commented out registration of the keypair plugin after creation:
screenshot_20171113_120206

The right approach might be to do display something selected in the list but remove any other controls and add a text "Missing plugin for backend auth".

  • add admin-friendly message whenever a storage backend is not found, something like "please verify that the apps providing the storage backend are installed and enabled". We can't tell which app it is though.

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather use 2 different messages or use a different message such as "number of invalid storages: $countInvalid"

Copy link
Member

Choose a reason for hiding this comment

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

I think the following style is the most used, so we should keep it for consistency. The same for the InvalidBackend

$this->setIdentifier($invalidId)
	->setScheme(self::SCHEME_NULL)
	->setText('Unknown auth mechanism backend ' . $invalidId);

@PVince81 PVince81 force-pushed the extstorage-invalidbackendhandling branch from 8230e45 to edeaf6a Compare November 13, 2017 11:32
@PVince81
Copy link
Contributor Author

UI fixed:

  • invalid storage backend:
    screenshot_20171113_123316

  • invalid auth backend:
    screenshot_20171113_123237

@PVince81 PVince81 force-pushed the extstorage-invalidbackendhandling branch 2 times, most recently from 5b31f3b to 104434e Compare November 13, 2017 14:13
@PVince81
Copy link
Contributor Author

@jvillafanez adjusted styles and fixed the failiing test

@PVince81
Copy link
Contributor Author

bah, of course I should have adjusted the tested message:
OCA\Files_External\Tests\Command\ListCommandTest.testDisplayWarningForIncomplete

Keep mount point visible and also ext storage config visible when
dealing with configs relating to storage backends or auth mechanisms
that were provided by an app that is currently disabled.
@PVince81 PVince81 force-pushed the extstorage-invalidbackendhandling branch from 104434e to cdda2f0 Compare November 14, 2017 08:29
@PVince81
Copy link
Contributor Author

Fixed last test.

Also, I checked the codecov https://codecov.io/gh/owncloud/core/pull/26539/diff and all is green 😄

@PVince81 PVince81 merged commit 4a13603 into master Nov 14, 2017
@PVince81 PVince81 deleted the extstorage-invalidbackendhandling branch November 14, 2017 16:17
@PVince81
Copy link
Contributor Author

stable10: #29562

@lock
Copy link

lock bot commented Aug 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable ext storage provider app must keep mount point

5 participants