elastic / logstash

Logstash - transport and process your logs, events, or other data
https://www.elastic.co/products/logstash
Other
61 stars 3.5k forks source link

refactor LogStash::PluginManager::Update#validate_major_version #3744

Open colinsurprenant opened 9 years ago

colinsurprenant commented 9 years ago

this method https://github.com/elastic/logstash/blob/028d76497ccef3a8d11a3528cdf6b99e8d10f070/lib/pluginmanager/update.rb#L70-L80 introduced by PR #3423 has a few issues:

colinsurprenant commented 9 years ago

this also relates to PR #3583 which introduces the --no-verify option. maybe just rely on that instead of the interactive Y/N ?

suyograo commented 9 years ago

I don't think we have prior-art for introducing an interactive Y/N in the logstash UI and I don't think this has been properly discussed in terms of strategy. what about automated updates? did we consider instead to introduce something like a --force options?

+1 on adding a --force or --no_prompt option to skip the [Y/N]. We also need to add this behavior in our docs

colinsurprenant commented 9 years ago

we should first make sure we do want to introduce interactive prompts in logstash (actually in the plugin manager) and if so provide a way to skip it. personally I'd prefer not to have interactive prompts and instead simply abort the process with the error and provide a way to force-update/skip the version validation.

colinsurprenant commented 9 years ago

The Y/N prompt is not integration-tests friendly as just discussed with @ph

ph commented 9 years ago

I like @talevy's idea to use -y flag, its similar to what debian aptitude uses.

talevy commented 9 years ago

++ to -y

colinsurprenant commented 9 years ago

@talevy @ph @suyograo any particular reason to keep an interactive prompt altogether? we don't have any other case of interactive prompts in logstash.

jordansissel commented 9 years ago

How about a --major-upgrade flag? Without it we log this error an exit with failure. Maybe?

talevy commented 9 years ago

@colinsurprenant a human should be aware that compatibility is not guaranteed, and this is really the only way to prevent a user from unintended, irreversible outcomes

colinsurprenant commented 9 years ago

@jordansissel +1

@talevy I am not following. it should simply fail by default with an appropriate error or proceed if given an override flag like --major-upgrade as suggested by @jordansissel

suyograo commented 9 years ago

@colinsurprenant There can be incompatible changes when a plugin gets updated (because of its own release cycle). As @talevy mentioned, a human should be able to intervene this update. We didn't have a precedent for this in LS before

suyograo commented 9 years ago

the default behavior can be Y/N prompts, but the integration tests and automated updates can use a --force_yes or some kind of a flag.

colinsurprenant commented 9 years ago

@suyograo for me this is the same as trying to install a plugin which does not have the proper metadata, it will fail, unless you pass the --no-verify flag. what's the difference here?

andrewvc commented 9 years ago

:+1: to @colinsurprenant let's keep the config options consistent

jordansissel commented 9 years ago

About --major upgrade - main idea was to target the flag at the specific concern. I dislike --force and --yes or similar because they don't have context as to what you are forcing or saying "yes" to.

colinsurprenant commented 9 years ago

For the interactive prompt: unless someone strongly disagree I suggest we move on and a) remove the interactive prompt b) by default fail on major version upgrade and c) add an override switch --major-upgrade.

purbon commented 9 years ago

I think there has been some clearance discussed here, I will try to provide a solution in a PR together with #3818, but still not sure about the fail on major upgrades? I like the idea of having a flag, and kinda dislike --force or --yes because of the context, .... what about no failing in case of major upgrade, but providing an option in case you want to be sure and apply this verification?

something like ---verify-major do you like this? I think this will provide an expected failure, I'm not sure I know other systems with restrictive upgrade policies like the one we're talking here.

suyograo commented 9 years ago

Related to https://github.com/elastic/logstash/issues/3993