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 #32488 - use rpm to remove pulp2 packages #473

Merged
merged 1 commit into from Jun 14, 2021

Conversation

jlsherrill
Copy link
Collaborator

as yum can remove other packages unexpectedly
(such as mod_ssl and more)

@theforeman-bot
Copy link
Member

Issues: #32488

python-pulp-manifest python-pulp-oid_validation python-pulp-ostree-common python-pulp-puppet-common
python-pulp-python-common python-pulp-repoauth python-pulp-rpm-common python-pulp-streamer python-pymongo
python-pymongo-gridfs python2-amqp python2-billiard python2-celery python2-debpkgr python2-django python2-kombu
python2-solv python2-vine)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a list of every rpm in the latest pulp2 repository, minus gofer packages which can be used for katello-agent. No additional packages are listed

python2-solv python2-vine)

@installed_pulp_packages ||= all_possible.select { |pkg| find_package(pkg) }
@installed_pulp_packages
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

here we only consider packages actually installed, and cache to not have to recalculate again when this method is called a 2nd time.

Comment on lines +27 to +35
possible = %w[pulp-admin-client pulp-agent pulp-consumer-client pulp-deb-admin-extensions
pulp-deb-plugins pulp-docker-admin-extensions pulp-docker-plugins
pulp-nodes-admin-extensions pulp-nodes-child pulp-nodes-common
pulp-nodes-consumer-extensions pulp-nodes-parent pulp-ostree-admin-extensions
pulp-ostree-plugins pulp-puppet-admin-extensions
pulp-puppet-consumer-extensions pulp-puppet-handlers pulp-puppet-plugins
pulp-puppet-tools pulp-python-admin-extensions pulp-python-plugins
pulp-rpm-admin-extensions pulp-rpm-consumer-extensions pulp-rpm-handlers
pulp-rpm-plugins pulp-rpm-yumplugins pulp-selinux pulp-server python-bson
Copy link
Member

Choose a reason for hiding this comment

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

Can't you use rpm -qa | grep ^pulp- or will that also match pulp 3 packages?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think both these suggestions would work, but to be honest i prefer this explicit list especially given the side effects we saw from users.

Comment on lines +37 to +42
python-pulp-agent-lib python-pulp-bindings python-pulp-client-lib
python-pulp-common python-pulp-deb-common python-pulp-devel
python-pulp-docker-common python-pulp-integrity python-pulp-manifest
python-pulp-oid_validation python-pulp-ostree-common python-pulp-puppet-common
python-pulp-python-common python-pulp-repoauth python-pulp-rpm-common
python-pulp-streamer python-pymongo python-pymongo-gridfs python2-amqp
Copy link
Member

Choose a reason for hiding this comment

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

Same here with ^python-pulp-

@upadhyeammit
Copy link
Contributor

Hello @jlsherrill

Changes look good to me! Apart from these changes can you also modify data_dir_removal_cmds as,

    def data_dir_removal_cmds
      pulp_data_dirs.collect { |dir| "rm -rf #{dir}" if File.directory?(dir)}.compact
    end

Accordingly remove directory check from delete_pulp_data. This way we will only show the directories we will actually remove and avoid the split in delete_pulp_data.

Thank you

@jlsherrill
Copy link
Collaborator Author

updated!

@upadhyeammit
Copy link
Contributor

updated!

Hello @jlsherrill can you remove if File.directory?(cmd.split[2]) from delete_pulp_data as we already have checked this in data_dir_removal_cmds. Thank you!

@jlsherrill
Copy link
Collaborator Author

updated!

@jturel
Copy link
Contributor

jturel commented Jun 11, 2021

Hit this while testing on a 4.0 box I upgrade from 3.18:

foreman-maintain content remove-pulp2
Running Remove Pulp2 and mongodb packages and data
================================================================================
Remove pulp2: 

WARNING: All pulp2 packages will be removed with the following commands:

# rpm -e pulp-deb-plugins  pulp-docker-plugins  pulp-puppet-plugins  pulp-puppet-tools  pulp-rpm-plugins  pulp-selinux  pulp-server  python-bson  python-crane  python-isodate  python-mongoengine  python-nectar  python-pulp-common  python-pulp-deb-common  python-pulp-docker-common  python-pulp-oid_validation  python-pulp-puppet-common  python-pulp-repoauth  python-pulp-rpm-common  python-pulp-streamer  python-pymongo  python-pymongo-gridfs  python2-amqp  python2-billiard  python2-celery  python2-debpkgr  python2-django  python2-kombu  python2-solv  python2-vine
# yum remove rh-mongodb34-*

All pulp2 data will be removed.

# rm -rf /var/lib/pulp/published
# rm -rf /var/lib/pulp/uploads
# rm -rf /var/lib/mongodb/

Do you want to proceed?, [y(yes), q(quit)] y
/ Removing pulp2 packages                                             [FAIL]    
Failed executing rpm -e pulp-deb-plugins  pulp-docker-plugins  pulp-puppet-plugins  pulp-puppet-tools  pulp-rpm-plugins  pulp-selinux  pulp-server  python-bson  python-crane  python-isodate  python-mongoengine  python-nectar  python-pulp-common  python-pulp-deb-common  python-pulp-docker-common  python-pulp-oid_validation  python-pulp-puppet-common  python-pulp-repoauth  python-pulp-rpm-common  python-pulp-streamer  python-pymongo  python-pymongo-gridfs  python2-amqp  python2-billiard  python2-celery  python2-debpkgr  python2-django  python2-kombu  python2-solv  python2-vine, exit status 30:
 error: Failed dependencies:
        pulp-server >= 2.8 is needed by (installed) pulp-katello-1.0.3-1.el7.noarch
        python-pulp-rpm-common is needed by (installed) pulp-katello-1.0.3-1.el7.noarch
--------------------------------------------------------------------------------
Scenario [Remove Pulp2 and mongodb packages and data] failed.

The following steps ended up in failing state:

  [pulp-remove]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="pulp-remove"

@jturel
Copy link
Contributor

jturel commented Jun 11, 2021

I added pulp-katello to the rpms to be removed and it succeeded.

Here's what's left over containing "pulp" or "mongo":

pulp-client-1.0-1.noarch
pulpcore-selinux-1.2.4-1.el7.x86_64
python3-mongoengine-0.20.0-1.el7.noarch
python3-pulp-2to3-migration-0.11.1-1.el7.noarch
python3-pulp-certguard-1.1.0-1.el7.noarch
python3-pulp-container-2.2.2-1.el7.noarch
python3-pulpcore-3.9.1-2.el7.noarch
python3-pulp-deb-2.9.2-1.el7.noarch
python3-pulp-file-1.5.0-1.el7.noarch
python3-pulp-rpm-3.10.0-1.el7.noarch
python3-pymongo-3.11.0-1.el7.x86_64
tfm-rubygem-pulp_2to3_migration_client-0.7.0-1.el7.noarch
tfm-rubygem-pulp_ansible_client-0.6.0-1.el7.noarch
tfm-rubygem-pulp_certguard_client-1.0.3-1.el7.noarch
tfm-rubygem-pulp_container_client-2.2.0-1.el7.noarch
tfm-rubygem-pulpcore_client-3.9.0-1.el7.noarch
tfm-rubygem-pulp_deb_client-2.9.1-1.el7.noarch
tfm-rubygem-pulp_file_client-1.5.0-1.el7.noarch
tfm-rubygem-pulp_rpm_client-3.10.0-1.el7.noarch
tfm-rubygem-smart_proxy_pulp-2.1.0-3.fm2_2.el7.noarch

The leftovers seem valid - but what about:

==============================================================================================================================================================================================
 Package                                                    Arch                                  Version                                      Repository                                Size
==============================================================================================================================================================================================
Removing:
 python3-pymongo                                            x86_64                                3.11.0-1.el7                                 @pulpcore                                3.4 M
Removing for dependencies:
 python3-mongoengine                                        noarch                                0.20.0-1.el7                                 @pulpcore                                1.0 M
 python3-pulp-2to3-migration                                noarch                                0.11.1-1.el7                                 @pulpcore                                1.1 M

as yum can remove other packages unexpectedly
(such as mod_ssl and more)
@jlsherrill
Copy link
Collaborator Author

not sure why i didn't hit that, but easy enough to add! Thanks @jturel Added!

Copy link
Contributor

@jturel jturel left a comment

Choose a reason for hiding this comment

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

ACK - tests well!

@jlsherrill
Copy link
Collaborator Author

@upadhyeammit can you merge please :)

@upadhyeammit upadhyeammit merged commit 073063b into theforeman:master Jun 14, 2021
@jlsherrill jlsherrill deleted the 32488 branch June 15, 2021 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants