Skip to content

Commit

Permalink
[api] publish only patchinfos in incidents by default
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Jan 25, 2012
1 parent c261ed6 commit 2b0bfa6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/api/app/controllers/request_controller.rb
Expand Up @@ -1517,6 +1517,7 @@ def command_changestate
patchinfo = DbPackage.new(:name => "patchinfo", :title => "Patchinfo", :description => "Collected packages for update")
incident_project.db_packages << patchinfo
patchinfo.add_flag("build", "enable", nil, nil)
patchinfo.add_flag("publish", "enable", nil, nil)
patchinfo.store

# create patchinfo XML file
Expand Down
1 change: 1 addition & 0 deletions src/api/app/controllers/source_controller.rb
Expand Up @@ -1898,6 +1898,7 @@ def index_project_createpatchinfo
pkg = DbPackage.new(:name => pkg_name, :title => "Patchinfo", :description => "Collected packages for update")
prj.db_packages << pkg
pkg.add_flag("build", "enable", nil, nil)
pkg.add_flag("publish", "enable", nil, nil)
pkg.store
end

Expand Down
3 changes: 2 additions & 1 deletion src/api/app/helpers/maintenance_helper.rb
Expand Up @@ -20,9 +20,10 @@ def create_new_maintenance_incident( maintenanceProject, baseProject = nil, requ
tprj.save
tprj.flags.create( :position => 1, :flag => 'build', :status => "disable" )
end
# publish is disabled, just patchinfos get enabled
tprj.flags.create( :flag => 'publish', :status => "disable" )
if noaccess
tprj.flags.create( :flag => 'access', :status => "disable" )
tprj.flags.create( :flag => 'publish', :status => "disable" )
end
# take over roles from maintenance project
maintenanceProject.project_user_role_relationships.each do |r|
Expand Down
14 changes: 14 additions & 0 deletions src/api/test/functional/maintenance_test.rb
Expand Up @@ -148,6 +148,16 @@ def test_mbranch_and_maintenance_per_package_request
get "/source/home:tom:branches:OBS_Maintained:pack2"
assert_response :success

# test build and publish flags
get "/source/#{maintenanceProject}/_meta"
assert_tag :parent => { :tag => "build" }, :tag => "disable"
assert_tag :parent => { :tag => "publish" }, :tag => "disable"
assert_response :success
get "/source/#{maintenanceProject}/patchinfo/_meta"
assert_response :success
assert_tag :parent => { :tag => "build" }, :tag => "enable"
assert_tag :parent => { :tag => "publish" }, :tag => "enable"

# create maintenance request with invalid target
post "/request?cmd=create", '<request>
<action type="maintenance_incident">
Expand Down Expand Up @@ -375,6 +385,10 @@ def test_mbranch_and_maintenance_entire_project_request
assert_response :success
assert_tag( :tag => "data", :attributes => { :name => "targetpackage"}, :content => "patchinfo" )
assert_tag( :tag => "data", :attributes => { :name => "targetproject"}, :content => "home:tom:branches:OBS_Maintained:pack2" )
get "/source/home:tom:branches:OBS_Maintained:pack2/patchinfo/_meta"
assert_response :success
assert_tag :parent => { :tag => "build" }, :tag => "enable"
assert_tag :parent => { :tag => "publish" }, :tag => "enable"

# create maintenance request
# without specifing target, the default target must get found via attribute
Expand Down

0 comments on commit 2b0bfa6

Please sign in to comment.