-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5129 from ehelms/fixes-9866
Fixes #9866: Properly remove Pulp sync schedule from products.
- Loading branch information
Showing
7 changed files
with
132 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# | ||
# Copyright 2014 Red Hat, Inc. | ||
# | ||
# This software is licensed to you under the GNU General Public | ||
# License as published by the Free Software Foundation; either version | ||
# 2 of the License (GPLv2) or (at your option) any later version. | ||
# There is NO WARRANTY for this software, express or implied, | ||
# including the implied warranties of MERCHANTABILITY, | ||
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should | ||
# have received a copy of GPLv2 along with this software; if not, see | ||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
|
||
module Actions | ||
module Katello | ||
module SyncPlan | ||
class AddProducts < Actions::EntryAction | ||
def plan(sync_plan, product_ids) | ||
action_subject(sync_plan) | ||
|
||
products = ::Katello::Product.where(:id => product_ids).editable | ||
sync_plan.product_ids = (sync_plan.product_ids + products.collect { |p| p.id }).uniq | ||
sync_plan.save! | ||
|
||
products.each do |product| | ||
plan_action(::Actions::Katello::Product::Update, product, :sync_plan_id => sync_plan.id) | ||
end | ||
end | ||
|
||
def humanized_name | ||
_("Add Sync Plan Products") | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# Copyright 2015 Red Hat, Inc. | ||
# | ||
# This software is licensed to you under the GNU General Public | ||
# License as published by the Free Software Foundation; either version | ||
# 2 of the License (GPLv2) or (at your option) any later version. | ||
# There is NO WARRANTY for this software, express or implied, | ||
# including the implied warranties of MERCHANTABILITY, | ||
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should | ||
# have received a copy of GPLv2 along with this software; if not, see | ||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
|
||
require 'katello_test_helper' | ||
|
||
describe ::Actions::Katello::SyncPlan::AddProducts do | ||
include Dynflow::Testing | ||
include Support::Actions::Fixtures | ||
include FactoryGirl::Syntax::Methods | ||
|
||
before :all do | ||
@product = katello_products(:fedora) | ||
@sync_plan = FactoryGirl.build( | ||
'katello_sync_plan', | ||
:products => [], | ||
:interval => 'daily', | ||
:sync_date => Time.now, | ||
:organization_id => Organization.first.id | ||
) | ||
end | ||
|
||
let(:action_class) { ::Actions::Katello::SyncPlan::AddProducts } | ||
let(:action) { create_action action_class } | ||
|
||
it 'plans' do | ||
action.stubs(:action_subject).with(@sync_plan) | ||
plan_action(action, @sync_plan, [@product.id]) | ||
|
||
assert_action_planed_with(action, ::Actions::Katello::Product::Update, @product, :sync_plan_id => @sync_plan.id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# Copyright 2015 Red Hat, Inc. | ||
# | ||
# This software is licensed to you under the GNU General Public | ||
# License as published by the Free Software Foundation; either version | ||
# 2 of the License (GPLv2) or (at your option) any later version. | ||
# There is NO WARRANTY for this software, express or implied, | ||
# including the implied warranties of MERCHANTABILITY, | ||
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should | ||
# have received a copy of GPLv2 along with this software; if not, see | ||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
|
||
require 'katello_test_helper' | ||
|
||
describe ::Actions::Katello::SyncPlan::RemoveProducts do | ||
include Dynflow::Testing | ||
include Support::Actions::Fixtures | ||
include FactoryGirl::Syntax::Methods | ||
|
||
before :all do | ||
@product = katello_products(:fedora) | ||
@sync_plan = FactoryGirl.build( | ||
'katello_sync_plan', | ||
:products => [@product], | ||
:interval => 'daily', | ||
:sync_date => Time.now, | ||
:organization_id => Organization.first.id | ||
) | ||
end | ||
|
||
let(:action_class) { ::Actions::Katello::SyncPlan::RemoveProducts } | ||
let(:action) { create_action action_class } | ||
|
||
it 'plans' do | ||
action.stubs(:action_subject).with(@sync_plan) | ||
plan_action(action, @sync_plan, [@product.id]) | ||
|
||
assert_action_planed_with(action, ::Actions::Katello::Product::Update, @product, :sync_plan_id => nil) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters