Skip to content

Commit

Permalink
reset pulpcore data for Satellite 6.10+
Browse files Browse the repository at this point in the history
Fixes: #402
  • Loading branch information
evgeni committed Mar 7, 2022
1 parent 055094d commit 0660210
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions roles/satellite-clone/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@
- not online_backup
- satellite_version in ["6.6", "6.7", "6.8", "6.9"]

- include_tasks: reset_pulpcore_data.yml
when:
- not clone_pulp_data_exists
- not online_backup
- satellite_version not in ["6.6", "6.7", "6.8", "6.9"]

- name: Wait 60 seconds for services to be fully up
wait_for: timeout=60

Expand Down
22 changes: 22 additions & 0 deletions roles/satellite-clone/tasks/reset_pulpcore_data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- name: reset pulpcore data
command: echo "Katello::Rpm.all.destroy_all; Katello::Erratum.all.destroy_all; Katello::PackageGroup.all.destroy_all; Katello::DockerManifest.all.destroy_all; Katello::DockerTag.all.destroy_all; Katello::AnsibleCollection.all.destroy_all" | foreman-rake console

- name: reset 7.0+ specific pulpcore data
command: echo "Katello::GenericContentUnit.all.destroy_all" | foreman-rake console
when:
- satellite_version not in ["6.10"]

- name: stop all services but the database
command: foreman-maintain service stop --exclude postgresql

- name: flush pulpcore db (reset pulp data)
command: sudo -u pulp PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager flush --noinput

- name: migrate pulpcore db (reset pulp data)
command: sudo -u pulp PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager migrate --noinput

- name: reset pulpcore admin password (reset pulp data)
command: sudo -u pulp PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager reset-admin-password --random

- name: start services
command: foreman-maintain service start

0 comments on commit 0660210

Please sign in to comment.