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

Fixes #28097 - Allow packages update with no packages #286

Merged
merged 6 commits into from
Feb 10, 2020

Conversation

mbacovsky
Copy link
Member

This patch lets packages update command to be invoked
without any args to update all packages.

This patch lets packages update command to be invoked
without any args to update all packages.
@theforeman-bot
Copy link
Member

Issues: #28097

@ntkathole
Copy link
Contributor

Aren't we allowing user here to perform upgrade with foreman-maintain packages update command without actually running foreman-maintain upgrade run command ? Currently I am not sure how will this have side effects, but, can we consider showing warning to use foreman-maintain upgrade run command rather than allowing it without args?

@mbacovsky
Copy link
Member Author

@ntkathole it is already possible we are making it just a bit more easy to use. I see your concern though, updating everything is probably too risky.

What others do think? Should we try to detect attempt to update everything and prevent it with deferring to f-m upgrade? @kgaikwad, @upadhyeammit, @gnurag

@upadhyeammit
Copy link
Contributor

@ntkathole it is already possible we are making it just a bit more easy to use. I see your concern though, updating everything is probably too risky.

What others do think? Should we try to detect attempt to update everything and prevent it with deferring to f-m upgrade? @kgaikwad, @upadhyeammit, @gnurag

I think we should put warning but should not prevent it, because we are doing this change to make it easier to update all packages[if required]. I can think of below use cases, if I missed anything then request to add,

  1. Update to packages which are of beta, or next major release.
    If user is doing this then he knows what are the implications. Because nowhere in document we have mentioned to manually change repositories to either beta or major release and do upgrade on GA.

  2. Update to EPEL packages, or upstream repository packages.
    In this use case I tried the after and before in confine block and it did not prioritize run. So here also user should be knowing what actions he is doing.

  3. Update to next z stream.
    Same as 1. but with less impact, we may or may not need to run the installer again.

Considering all these I feel warning should be sufficient.

@kgaikwad
Copy link
Member

@mbacovsky,
As it is a risky operation and considering users don't always read the docs before running any command, I agree with @ntkathole & @upadhyeammit on showing a warning message than updating everything.
Though foreman-maintain packages update command is running a installer command after packages update, there might be a chance that manual step(s) will be involved during upgrade from one version to other. That's why it is better not to leave system in broken state.

@mbacovsky
Copy link
Member Author

Thanks everybody for your input. I'm going to print a warning that packages update should not be used instead of upgrade run.

@kgaikwad does your suggestion mean we shouldn't allow packages update with no arg?

@kgaikwad
Copy link
Member

Thanks everybody for your input. I'm going to print a warning that packages update should not be used instead of upgrade run.

@kgaikwad does your suggestion mean we shouldn't allow packages update with no arg?

Yes, by considering the points(1st & 3rd) mentioned by @upadhyeammit and IIRC, in the past few issues were reported by users around yum update command.
If we would like to implement it in this way then it would be good to have more suggestions on this change.

@mbacovsky
Copy link
Member Author

I've added the confirmation.

@jameerpathan111
Copy link
Contributor

@mbacovsky
The warning message is not shown properly when I ran foreman-maintain packages update --assumeyes command.

================================================================================
Confirm update all is intentionall: 

WARNING: No speciffic packages to update were provided so we are going to update all available packages.
It is recommended to update everything only as part of upgrade of the Satellite to the next version. 
To Upgrade to next version use 'foreman-maintain upgrade'.

                                                                      [OK]      ns? (assuming yes)
--------------------------------------------------------------------------------
Confirm installer run is allowed: 

Line Do you want to proceed with update of everything regardless of the recommendations?, [y(yes), q(quit)] y is missing.

@mbacovsky
Copy link
Member Author

@jameerpathan111 the output should be fixed now. I've seen the same behavior elsewhere too so it should be fixed globally.

@kgaikwad, I agree that allowing users to update everything is not the ideal but it still seems better then forcing users to come up with workaround by providing wildcards or turning the locking off completely. So I used the wording indicating that updating everything is risky and what we recommend but allowed to proceed. Is that acceptable for you? Would it make sense to disable --assumeyes for this situation?

@jameerpathan111
Copy link
Contributor

@jameerpathan111 the output should be fixed now. I've seen the same behavior elsewhere too so it should be fixed globally.

Yes, it seems to be fixed now.

@kgaikwad
Copy link
Member

kgaikwad commented Nov 6, 2019

Is that acceptable for you? Would it make sense to disable --assumeyes for this situation?

+1 for the warning message and asking user before proceeding further.
As it is the risky and probably won't be possible to bring back to original state once ran so I think we should avoid having --assumeyes option for this at least in the beginning.

@jameerpathan111
Copy link
Contributor

@mbacovsky @kgaikwad if we remove --assumeyes option it'll cause problem in customer automation.

@mbacovsky
Copy link
Member Author

@jameerpathan111 I guess that is the point. This shouldn't be automated at all. Currently we do not support update without parameters. The --assumeyes should stay with the command we will just ignore --assumeyes on parameterless update. We can inform that the option was ignored on purpose. Would that be acceptable?

@jameerpathan111
Copy link
Contributor

@jameerpathan111 I guess that is the point. This shouldn't be automated at all. Currently we do not support update without parameters. The --assumeyes should stay with the command we will just ignore --assumeyes on parameterless update. We can inform that the option was ignored on purpose. Would that be acceptable?

yes

@mbacovsky
Copy link
Member Author

Updated according to our previous discussion.

Also please note I loosend the HashSyntax cop a bit from Hash_rocket to no_mixed_keys. The reason was it fails on keyword argument and it seems there is no remedy for that. I checked the setting on Foreman core and this cop is turned off there. If anybody has concerns with this change please speak up.

metadata do
param :packages, 'List of packages to update', :array => true

description 'Confirm update all is intentionall'
Copy link
Member

Choose a reason for hiding this comment

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

s/intentionall/intentional/

Copy link
Member Author

Choose a reason for hiding this comment

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

@gnurag thanks, updated.

Copy link
Member

@kgaikwad kgaikwad left a comment

Choose a reason for hiding this comment

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

+1 for hashsyntax style no_mixed_keys.

@kgaikwad
Copy link
Member

kgaikwad commented Dec 9, 2019

@upadhyeammit, @gnurag, any additional comments?

@jameerpathan111, would you like to do final round of testing with updated changes?

@upadhyeammit
Copy link
Contributor

@upadhyeammit, @gnurag, any additional comments?

@jameerpathan111, would you like to do final round of testing with updated changes?

Nothing else from my side.

@kgaikwad kgaikwad added the 0.5.x pull-requests targeted for next version 0.5.x(downstream) label Jan 9, 2020
@jameerpathan111
Copy link
Contributor

@jameerpathan111, would you like to do final round of testing with updated changes?

@kgaikwad tested this PR and it works as expected.
Observation:

This is how output of command now looks like:

# foreman-maintain packages update --assumeyes 
Running preparation steps required to run the next scenarios
================================================================================
Check if tooling for package locking is installed:                    [OK]
--------------------------------------------------------------------------------


Running update packages in unlocked session
================================================================================
Confirm update all is intentional: 

WARNING: No specific packages to update were provided
so we are going to update all available packages.
It is recommended to update everything only as part of upgrade
of the Satellite to the next version. 
To Upgrade to next version use 'foreman-maintain upgrade'.

NOTE: --assumeyes is not applicable for this check

Do you want to proceed with update of everything regardless
of the recommendations?, [y(yes), q(quit)] y
                                                                      [OK]      
--------------------------------------------------------------------------------
Confirm installer run is allowed: 

WARNING: This script runs satellite-installer after the yum execution 
to ensure the Satellite is in a consistent state.
As a result some of your services may be restarted. 

Do you want to proceed? (assuming yes)   ---> Here assumeyes is working.
                                                                      [OK]      
--------------------------------------------------------------------------------
Unlock packages:                                                      [OK]
--------------------------------------------------------------------------------
Update package(s) :                                                   [OK]
--------------------------------------------------------------------------------
==============================================================================================================================================================
 Package                                           Arch   Version                          Repository                                                    Size
==============================================================================================================================================================
Updating:
*****************************
****  Output omitted   ****
*****************************
foreman-rake upgrade:run finished successfully!
Upgrade completed!
Package versions are being locked.
       [OK]
--------------------------------------------------------------------------------
Check status of version locking of packages: 
  Automatic locking of package versions is enabled in installer.
  Packages are locked.                                                [OK]
--------------------------------------------------------------------------------

@kgaikwad
Copy link
Member

Thank you @jameerpathan111 for testing this PR.
Merging this pull-request..

@kgaikwad kgaikwad merged commit b6b2581 into theforeman:master Feb 10, 2020
@kgaikwad
Copy link
Member

Thank you @mbacovsky 🎉 👌

Thanks @upadhyeammit, @gnurag for reviewing this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.5.x pull-requests targeted for next version 0.5.x(downstream) Needs testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants