[Satellite v6] Sync Plan still runs after removing it from the WEBUI
Environment
- Red Hat Satellite v6.0.x
Issue
- Sync plan executes even after removing it from the Satellite WEBUI.
Resolution
- This issue was fixed in version
6.1.1
of Satellite which was released on 12 August, 2015.
To confirm that you are hitting the issue:
- Create a rake file
/usr/share/foreman/lib/tasks/schedules.rake
with the below contents.
[root@satellite-server ~]# vi /usr/share/foreman/lib/tasks/schedules.rake
task :list_active_sync_schedules => :environment do
User.current = User.first
products = ::Katello::Product.joins(:repositories).uniq
products.each do |product|
product.repositories.each do |repo|
schedules = Katello.pulp_server.resources.repository_schedule.list(repo.pulp_id, repo.importer_type)
if !schedules.empty?
puts "'#{repo.name}' in Product '#{product.name}' with product ID '#{product.id}' has #{schedules.length} sync plans attached to them"
end
end
end
end
task :cleanup_sync_schedules => :environment do
User.current = User.first
if ENV['product_id']
product = Katello::Product.find(ENV['product_id'])
puts "Removing sync schedules for product: #{product.name}"
product.repositories.each do |repo|
repo.set_sync_schedule(nil)
end
product.sync_plan = nil
product.save!
else
puts "Please specify a product ID to remove sync schedules for (e.g. rake cleanup_sync_schedules product_id=1)"
end
end
- Execute the following command to list the sync schedules.
[root@satellite-server ~]# foreman-rake list_active_sync_schedules
Diagnostic Steps
-
Install and setup pulp-admin command as described here.
-
Login to the
pulp
with the below pulp-admin command.
[root@satellite-server ~]# pulp-admin login -u admin -p `grep "^default_password:" /etc/pulp/server.conf | awk '{print $2}'`
- Check for the next sync schedule using the below command.
[root@satellite-server ~]# for I in $(pulp-admin rpm repo list --fields id|perl -pe 's/\n//g'|perl -pe 's/Id:/\nId:/g'|grep Id:|sed -e 's/ //g'|awk '{ print $2; }');do echo $I;pulp-admin rpm repo sync schedules list --repo-id $I;echo;done
GSS-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_6_Server_RPMs_x86_64_6Server
+----------------------------------------------------------------------+
Schedules
+----------------------------------------------------------------------+
Schedule: 2015-06-18T15:15:00Z/PT24H
Id: 5582d2d8f432d117b571da34
Enabled: True
Next Run: 2015-06-18T15:15:00Z
GSS-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_5_Server_Kickstart_x86_64_5Server
+----------------------------------------------------------------------+
Schedules
+----------------------------------------------------------------------+
Schedule: 2015-06-18T15:15:00Z/PT24H
Id: 5582d2d5f432d117b571da0c
Enabled: True
Next Run: 2015-06-18T15:15:00Z
GSS-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_5_Server_-_RH_Common_RPMs_x86_64_5Server
+----------------------------------------------------------------------+
Schedules
+----------------------------------------------------------------------+
Schedule: 2015-06-18T15:15:00Z/PT24H
Id: 5582d2d5f432d117b571da11
Enabled: True
Next Run: 2015-06-18T15:15:00Z
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments