summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Callaghan <dcallagh@redhat.com>2012-05-30 02:20:36 -0400
committerGerrit Code Review <gerrit@beaker-project.org>2012-05-30 02:20:36 -0400
commit4a0285100be473dbb5edce70b40fa2479fc45e7f (patch)
tree237d2b7eb51bd65a562f7c0b494456d171a19fa8
parentf5b73b69e6df8a41fbcfcc9c0d703cbc2ab8976b (diff)
parentda4527073c22e9d57caef2480cf83e5faa27a1a5 (diff)
Merge "fix recipe install option handling so as not to discard ! options" into develop
-rw-r--r--IntegrationTests/src/bkr/inttest/server/test_beakerd.py31
-rw-r--r--IntegrationTests/src/bkr/inttest/server/test_model.py5
-rw-r--r--Server/bkr/server/model.py10
3 files changed, 38 insertions, 8 deletions
diff --git a/IntegrationTests/src/bkr/inttest/server/test_beakerd.py b/IntegrationTests/src/bkr/inttest/server/test_beakerd.py
index 2479fb7..da0948e 100644
--- a/IntegrationTests/src/bkr/inttest/server/test_beakerd.py
+++ b/IntegrationTests/src/bkr/inttest/server/test_beakerd.py
@@ -1,6 +1,7 @@
import unittest, datetime, os, threading
from bkr.server.model import TaskStatus, Job, System, User, \
- Group, SystemStatus, SystemActivity, Recipe, LabController
+ Group, SystemStatus, SystemActivity, Recipe, LabController, \
+ Provision
import sqlalchemy.orm
from turbogears.database import session
import xmltramp
@@ -364,6 +365,34 @@ class TestBeakerd(unittest.TestCase):
self.assertEqual(system.command_queue[1].action, 'configure_netboot')
self.assertEqual(system.command_queue[2].action, 'clear_logs')
+ # https://bugzilla.redhat.com/show_bug.cgi?id=826379
+ def test_recipe_install_options_can_remove_system_options(self):
+ with session.begin():
+ distro_tree = data_setup.create_distro_tree(osmajor=u'Fedora')
+ system = data_setup.create_system(shared=True,
+ lab_controller=self.lab_controller)
+ system.provisions[distro_tree.arch] = Provision(arch=distro_tree.arch,
+ kernel_options='console=ttyS0 vnc')
+ job = data_setup.create_job(distro_tree=distro_tree)
+ job.recipesets[0].recipes[0].kernel_options = u'!vnc'
+ job.recipesets[0].recipes[0]._host_requires = (u"""
+ <hostRequires>
+ <hostname op="=" value="%s" />
+ </hostRequires>
+ """ % system.fqdn)
+
+ beakerd.new_recipes()
+ beakerd.processed_recipesets()
+ beakerd.queued_recipes()
+ beakerd.scheduled_recipes()
+
+ with session.begin():
+ job = Job.query.get(job.id)
+ self.assertEqual(job.status, TaskStatus.running)
+ system = System.query.get(system.id)
+ self.assertEqual(system.command_queue[1].action, 'configure_netboot')
+ self.assert_('vnc' not in system.command_queue[1].kernel_options)
+
def test_order_by(self):
controller = Jobs()
with session.begin():
diff --git a/IntegrationTests/src/bkr/inttest/server/test_model.py b/IntegrationTests/src/bkr/inttest/server/test_model.py
index 16990c3..8554043 100644
--- a/IntegrationTests/src/bkr/inttest/server/test_model.py
+++ b/IntegrationTests/src/bkr/inttest/server/test_model.py
@@ -68,11 +68,12 @@ class TestSystem(unittest.TestCase):
distro_tree = data_setup.create_distro_tree()
system = data_setup.create_system()
system.provisions[distro_tree.arch] = Provision(arch=distro_tree.arch,
- kernel_options='console=ttyS0 ksdevice=eth0')
+ kernel_options='console=ttyS0 ksdevice=eth0 vnc')
opts = system.install_options(distro_tree).combined_with(
- InstallOptions.from_strings('', u'ksdevice=eth1', ''))
+ InstallOptions.from_strings('', u'ksdevice=eth1 !vnc', ''))
# ksdevice should be overriden but console should be inherited
# noverifyssl comes from server-test.cfg
+ # vnc should be removed
self.assertEqual(opts.kernel_options,
dict(console='ttyS0', ksdevice='eth1', noverifyssl=None))
diff --git a/Server/bkr/server/model.py b/Server/bkr/server/model.py
index 50fa78b..d5189b0 100644
--- a/Server/bkr/server/model.py
+++ b/Server/bkr/server/model.py
@@ -4394,7 +4394,7 @@ class Recipe(TaskBase):
return ("beaker-harness", "http://%s/harness/%s/"
% (self.servername, self.distro_tree.distro.osversion.osmajor))
- def install_options(self):
+ def generated_install_options(self):
ks_meta = {
'packages': ':'.join(p.package for p in self.packages),
'customrepos': '|'.join('%s,%s' % (r.name, r.url) for r in self.repos),
@@ -4402,9 +4402,7 @@ class Recipe(TaskBase):
'taskrepo': '%s,%s' % self.task_repo(),
'partitions': self.partitionsKSMeta,
}
- return InstallOptions(ks_meta, {}, {})\
- .combined_with(InstallOptions.from_strings(self.ks_meta,
- self.kernel_options, self.kernel_options_post))
+ return InstallOptions(ks_meta, {}, {})
def to_xml(self, recipe, clone=False, from_recipeset=False, from_machine=False):
if not clone:
@@ -4792,7 +4790,9 @@ class Recipe(TaskBase):
def provision(self):
from bkr.server.kickstart import generate_kickstart
install_options = self.system.install_options(self.distro_tree)\
- .combined_with(self.install_options())
+ .combined_with(self.generated_install_options())\
+ .combined_with(InstallOptions.from_strings(self.ks_meta,
+ self.kernel_options, self.kernel_options_post))
if 'ks' in install_options.kernel_options:
# Use it as is
pass