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

To use 'encapsia plugins install' without confirmation you need to use --force; Maybe create a -y for click.confirm? #52

Closed
adiniscmed opened this issue Jan 13, 2021 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@adiniscmed
Copy link
Contributor

No description provided.

@petrem
Copy link
Collaborator

petrem commented Jan 27, 2021

What's your usecase?

@petrem petrem added the enhancement New feature or request label Jan 27, 2021
@adiniscmed
Copy link
Contributor Author

There are two cases where this would be usefull:

One is on upgrading a set of plugins on several servers with a script/automated or even manually, it prompts for Y (user input) on each run. If using --force, it will reinstall the already installed plugins.

The second one is on initial plugin install on a server/system, where you want to install all plugins for the first time with a script/automated, and it prompts for Y (user input) (this actually can be solved using --force, but is used inappropriately)

@petrem
Copy link
Collaborator

petrem commented Jun 3, 2021

Ok, so I assume this would be something like --assume-yes, meaning "Do not prompt on sane requests" rather than the "Shut up and break my system" of --force.

How do you feel about downgrades? I'd rather not automatically do those with this new flag.

@mpopetcmed mpopetcmed self-assigned this Dec 15, 2022
@petrem
Copy link
Collaborator

petrem commented Jan 5, 2023

Confirmation dialogues

There are multiple confirmation prompts in other places, described in the table below.
The line numbers are valid with the current master, at commit 9c31728.

Potentially problematic situations, where the action might not be what the user intended when issuing --force, are highlighted (see more below).

File Command Actions confirmed by prompt
plugins.py:393 install install new plugin; downgrade plugin; upgrade plugin; reinstall plugin
plugins.py:437 uninstall uninstall new plugin
plugins.py:576 dev-destroy destroy (plugin) namespace(s)
database.py:38 restore restore from backup
fixtures.py:47 use use fixture
fixtures.py:64 delete delete (existing) fixture

Except where highlighted, --force "means" --yes|--assume-yes, quite naturally. The name of the option, --force, is, possibly, well, forced.

Issues

There are two distinct issues with --force for plugins install:

  • It will reinstall existing plugins. This is useless and undesirable most of the time, but we need to be able to perform reinstall.
  • It will happily downgrade plugins. This may be surprising and not what the user desired but of course we need to be able to perform the action.

Proposed new options and changes

A compromise could be to keep the existing --force with the same meaning (and mark it deprecated), and add new options, at each "leaf" sub-command level, with more concise meaning:

Command Option Meaning
plugins install --yes Do not prompt for confirmation. This will not automatically downgrade or reinstall.
plugins install --reinstall Change default behaviour to never reinstall by default. With this option, selected plugins would be reinstalled.
plugins install --downgrade Change default behaviour to never downgrade by default. With this option, selected plugins would be downgraded.
plugins install --force Do not prompt for confirmation, reinstall and downgrade. Same as --yes --reinstall --downgrade.
plugins dev-destroy --yes | --force Do not prompt for confirmation.
database restore --yes | --force Do not prompt for confirmation.
fixtures use --yes | --force Do not prompt for confirmation.
fixtures delete --yes | --force Do not prompt for confirmation.

[Implementation detail] Deprecating --force could be done e.g. as described in https://stackoverflow.com/a/50402799/3540204 . Or wait for pallets/click#2263 ...

@rosselliott
Copy link

+1 to --yes, --reinstall, and --downgrade.
Anything to get us to pay more attention to what we are installing.
Is there any Sys Ops tooling that needs to change to take account of this or does it check desired plugin versions and install as needed?

@petrem
Copy link
Collaborator

petrem commented Jan 5, 2023

Sys ops state that they are not using encapsia-cli anymore, or at least not in their toolchain. Testing does, however, use the CLI so they might need to adapt.

@mpopetcmed
Copy link
Contributor

mpopetcmed commented Jan 31, 2023

If we intend to deprecate --force, we should provide an alternative CL option.
These are the plugins subcommands that are currently using --force.

(if suggested option is in bold, it was taken from Petre's previous suggestions)

Subcommand Context Suggested option
install _add_to_local_store_from_s3 <=> overwrite if file already exists in local store --overwrite
create_install_plan => reinstall if same version --reinstall
create_install_plan => downgrade if older version --downgrade
do not prompt for confirmation --yes
uninstall do not prompt for confirmation --yes
dev_update _get_modified_plugin_directories => upload all directories, not only the modified ones --all
dev_destroy do not prompt for confirmation --yes
dev_build overwrite existing plugin file in local store --overwrite
add _download_plugins_from_s3 + _add_to_local_store_from_uri => overwrite if file already exists in local store --overwrite

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

No branches or pull requests

4 participants