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

files_external:export and import of local mounts #37054

Closed
phil-davis opened this issue Mar 2, 2020 · 3 comments · Fixed by #37513
Closed

files_external:export and import of local mounts #37054

phil-davis opened this issue Mar 2, 2020 · 3 comments · Fixed by #37513

Comments

@phil-davis
Copy link
Contributor

phil-davis commented Mar 2, 2020

Steps to reproduce

  1. have some local mount zzz
$ php occ files_external:list
+----------+-------------+---------+---------------------+---------------+---------+------------------+-------------------+
| Mount ID | Mount Point | Storage | Authentication Type | Configuration | Options | Applicable Users | Applicable Groups |
+----------+-------------+---------+---------------------+---------------+---------+------------------+-------------------+
| 4        | /zzz        | Local   | None                |               |         | All              |                   |
+----------+-------------+---------+---------------------+---------------+---------+------------------+-------------------+
  1. export those settings:
$ php occ files_external:export > zzz.dat
$ cat zzz.dat
cat zzz.dat
[
    {
        "mount_id": 5,
        "mount_point": "\/zzz",
        "storage": "Local",
        "authentication_type": "None",
        "configuration": "",
        "options": "",
        "applicable_users": "All",
        "applicable_groups": ""
    }
]
  1. delete the mount point
$ php occ files_external:delete 4
$ php occ files_external:list
No admin mounts configured
  1. try to import the mount point:
$ php occ files_external:import zzz.dat
An unhandled exception has been thrown:
TypeError: Argument 1 passed to OC\Files\External\StorageConfig::setBackend() must be an instance of OCP\Files\External\Backend\Backend, null given, called in /home/phil/git/owncloud/core/apps/files_external/lib/Command/Import.php on line 185 and defined in /home/phil/git/owncloud/core/lib/private/Files/External/StorageConfig.php:180
Stack trace:
#0 /home/phil/git/owncloud/core/apps/files_external/lib/Command/Import.php(185): OC\Files\External\StorageConfig->setBackend(NULL)
#1 /home/phil/git/owncloud/core/apps/files_external/lib/Command/Import.php(134): OCA\Files_External\Command\Import->parseData(Array, Object(OC\Files\External\Service\GlobalStoragesService))
#2 [internal function]: OCA\Files_External\Command\Import->OCA\Files_External\Command\{closure}(Array)
#3 /home/phil/git/owncloud/core/apps/files_external/lib/Command/Import.php(135): array_map(Object(Closure), Array)
#4 /home/phil/git/owncloud/core/lib/composer/symfony/console/Command/Command.php(255): OCA\Files_External\Command\Import->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /home/phil/git/owncloud/core/core/Command/Base.php(159): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /home/phil/git/owncloud/core/lib/composer/symfony/console/Application.php(1001): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /home/phil/git/owncloud/core/lib/composer/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files_External\Command\Import), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /home/phil/git/owncloud/core/lib/composer/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /home/phil/git/owncloud/core/lib/private/Console/Application.php(165): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /home/phil/git/owncloud/core/console.php(116): OC\Console\Application->run()
#11 /home/phil/git/owncloud/core/occ(11): require_once('/home/phil/git/...')

Expected behaviour

Should be able to import from the export of a local mount

Actual behaviour

It crashes (see traceback above)

Server configuration

Current core master

Noticed while adding files_external occ command tests issue #36704

@phil-davis
Copy link
Contributor Author

phil-davis commented Mar 2, 2020

If I edit the exported JSON and adjust storage Local to have the full class name of the storage, and adjust the authentication_type to be null::null (instead of None) then the import works.

[
    {
        "mount_id": 3,
        "mount_point": "\/zzz",
        "storage": "\\OC\\Files\\Storage\\Local",
        "authentication_type": "null::null",
        "configuration": "datadir: \"\\\/home\\\/phil\\\/tmp\"",
        "options": "",
        "applicable_users": "All",
        "applicable_groups": ""
    }
]

Maybe files_external:export needs fixing so that it outputs the correct technical detail?

@phil-davis
Copy link
Contributor Author

phil-davis commented Mar 2, 2020

Also note, when I change the system language to de then files_external:export outputs:

[
    {
        "mount_id": 3,
        "mount_point": "\/zzz",
        "storage": "Lokal",
        "authentication_type": "Keine",
        "configuration": "",
        "options": "",
        "applicable_users": "All",
        "applicable_groups": ""
    }
]

storage and authentication_type got translated - but those values are technical settings, not words to be translated.

Noticed while thinking about owncloud/QA#608

@phil-davis
Copy link
Contributor Author

phil-davis commented Mar 30, 2020

QA has provided test scenarios that demonstrate the problems - #37123 - so I have taken off QA labels and assignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants