Description of problem: Creating a custom kickstart distribution using the same label for two different orgs results in an ISE during the download of the kicsktart tree files. org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835) at com.redhat.rhn.domain.kickstart.KickstartFactory.lookupKickstartTreeByLabel(KickstartFactory.java:645) at com.redhat.rhn.frontend.action.common.DownloadFile.handleKickstartDownload(DownloadFile.java:269) at com.redhat.rhn.frontend.action.common.DownloadFile.execute(DownloadFile.java:125) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) ... 40 more It appears we are using a hiberate query to select by label only and not by label/org_id currently investigating and plan on proposing a patch.
Created attachment 912958 [details] patch to fix media_path for custom kickstart distributions
Committing to Spacewalk master: cd0a7132d6fe8a1b24f6078bd079e9757db1f2bc Note that this will fix Kickstart Distributions that are created / modified in the future, but not currently existing Distributions.
And Checkstyle fix: 789f173e74eacc279b9b3ece5506cdb4a3996055
Reproducer: 1. create first organization A a) download image to server and create distribution "Fedora-21" in A org b) create new kickstart with this distribution in org B 2. create second organization B a) create new distribution "Fedora-21" in B org b) create new kickstart with this distribution in org B 3) Try to provision system with this kickstart or go to web page a) /ks/dist/Fedora-21 (ISE 500) b) /ks/dist/org/2/Fedora-21 (ISE 500) c) /ks/dist/org/1/Fedora-21 (ok)
Re-verified spacewalk-java-2.3.8-96 Used reproducer from comment 7. Do not use its last a,b,c) part as this part of the reproducer is wrong. Kickstart file now contains "url --url http://<fqdn>/ks/dist/org/<org_id>/<ks_label>" instead of http://<fqdn>/ks/dist/<ks_label>