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

Add command to get and set config for external mounts #20710

Merged
merged 3 commits into from
Dec 1, 2015

Conversation

icewind1991
Copy link
Contributor

Usage:

usage

Currently this only works for admin configured storage due to limitations in the way we store mounts, with #20370 it can be extended to properly handle user configured mounts

cc @PVince81 @Xenopathic

@RobinMcCorkell
Copy link
Member

Woah, nice! (Will review in the next few days)

@PVince81
Copy link
Contributor

@icewind1991 can you always post a link to the original ticket it is related to ?

For #20368

@PVince81
Copy link
Contributor

Looks good 👍

->setName('files_external:config')
->setDescription('Manage backend configuration for a mount')
->addArgument(
'action',
Copy link
Member

Choose a reason for hiding this comment

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

It would be cleaner to get if there is no value passed, and set if there is a value passed, removing the need for a separate command line argument.

Proposed example usage:

./occ files_external:config 42 host #prints 'localhost'
./occ files_external:config 42 host abc.example.com #sets host

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems cleaner yes

@icewind1991 icewind1991 force-pushed the files_external_config_command branch from 219ac67 to 6ed4dcc Compare November 25, 2015 15:18
@icewind1991
Copy link
Contributor Author

Removed the get/set argument, action is now determined based on if the value is defined

@icewind1991
Copy link
Contributor Author

Also added command to set mount options occ files_external:option which is used in the same way

$key = $input->getArgument('key');
$mount = $this->globalService->getStorage($mountId);

if (!$mount instanceof StorageConfig) {
Copy link
Member

Choose a reason for hiding this comment

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

The storage service will throw an exception itself if the storage cannot be found, so this block is unneeded (but it might be advisable to wrap the getStorage() in a try catch to print a better message)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@icewind1991 icewind1991 force-pushed the files_external_config_command branch from e7efbe9 to 1e1cb7a Compare November 25, 2015 15:38
$mount = $this->globalService->getStorage($mountId);
} catch (NotFoundException $e) {
$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
return;
Copy link
Member

Choose a reason for hiding this comment

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

Return with a non-zero code so shell scripts can detect the error

Copy link
Contributor

Choose a reason for hiding this comment

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

@icewind1991 can you fix this and then I'll count @Xenopathic's LGTM as 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@RobinMcCorkell
Copy link
Member

LGTM so far, just one question: how can we set non-string values, e.g. integers or booleans?

@icewind1991
Copy link
Contributor Author

You can just enter them directory, bools, ints and floats are all handled correctly

@PVince81
Copy link
Contributor

@Xenopathic counts as 👍 ?

@icewind1991
Copy link
Contributor Author

@Xenopathic @DeepDiver1975 merge?

@RobinMcCorkell
Copy link
Member

@icewind1991 icewind1991 force-pushed the files_external_config_command branch from 1e1cb7a to 1347e33 Compare December 1, 2015 12:48
@RobinMcCorkell
Copy link
Member

👍

DeepDiver1975 added a commit that referenced this pull request Dec 1, 2015
Add command to get and set config for external mounts
@DeepDiver1975 DeepDiver1975 merged commit 27da638 into master Dec 1, 2015
@DeepDiver1975 DeepDiver1975 deleted the files_external_config_command branch December 1, 2015 14:27
@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 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.

4 participants