Hide Forgot
Description of problem: If user passes tree_repos variable via Kickstart Metadata, repourl is not handled properly by rhts_post snippet. Following are the two problems: 1. Delimiter is ':'. This causes the url to be split after 'http'. 2. baseurl=http://$server/distros$repourl. If user passes tree_repos=http://example/RHEL/6/Server/x86_64/os/Server, baseurl prepends additional contents. This generates wrong baseurl. Version-Release number of selected component (if applicable): 0.6.12-1 How reproducible: Always Steps to Reproduce: 1.Add tree_repos variable to Kickstart Metadata 2.Create a job with simple task 3.Look at contents in /etc/yum.repos.d/beaker-distro* Actual results: Two distro repos are created. 1. baseurl=http://<server>/distroshttp 2. baseurl=http://<server>/distro//RHEL/6/Server/x86_64/os/Server Expected results: One distro repo with baseurl=http://example/RHEL/6/Server/x86_64/os/Server Additional info: Replacing delimiter ':' with '|' similar to harnessrepos & customrepos fixes issue 1. Replacing baseurl=http://$server/distros$repourl with baseurl=$repourl fixes issue 2. This is how harnessrepos and customrepos set baseurl.
I can't break our existing tree_repos so the following patch may work. diff --git a/LabController/snippets/rhts_post b/LabController/snippets/rhts_post index c361562..79d5de0 100644 --- a/LabController/snippets/rhts_post +++ b/LabController/snippets/rhts_post @@ -57,9 +57,17 @@ popd #end if # Add Distro Repos -#if $getVar('tree_repos','') != '' +#set $tree_repos = $getVar('tree_repos','') +#if $tree_repos != '' +#if $tree_repos.find("http://") != -1 +#set $split = "|" +#set $base = "" +#else +#set $split = ":" +#set $base = "http://$server/distros"" +#end if #set $i = 0 -#for $repo in $getVar('tree_repos','').split(':') +#for $repo in $getVar('tree_repos','').split($split) #set $i = $i + 1 #if $repo.find(",") != -1 #set (reponame, repourl) = $repo.split(',',1) @@ -70,7 +78,7 @@ popd cat << EOF > /etc/yum.repos.d/${reponame}.repo [$reponame] name=$reponame -baseurl=http://$server/distros$repourl +baseurl=$base$repourl enabled=1 gpgcheck=0 skip_if_unavailable=1 Posting to for feedback. This has not been tested.
This works for me. there is one small bug here: +#set $base = "http://$server/distros"" double quotes at the end. The above bug caused cobbler to not generate a proper kickstart file. Also, even though kickstart file was not generated, the job kept running instead of failing. Maybe another bug to file?
I'll fix the double quote mistake. Thanks for testing it. The job would have failed when the watchdog timed out ( should be 20 minutes I believe). Unless beaker-watchdog was not running of course.
I didn't wait for 20 minutes :)
pushed to gerrit for review