diff options
-rw-r--r-- | cobbler/utils.py | 2 | ||||
-rw-r--r-- | config/.htaccess | 3 | ||||
-rw-r--r-- | tests/tests.py | 56 |
3 files changed, 57 insertions, 4 deletions
diff --git a/cobbler/utils.py b/cobbler/utils.py index f9f73b1..db55128 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -280,7 +280,7 @@ def blender(api_handle,remove_hashes, root_obj, blend_cache=None): consolidated data. """ - cache_enabled = False + cache_enabled = False # FIXME: disabled for now as there a few bugs in this impl. blend_key = "%s/%s/%s" % (root_obj.TYPE_NAME, root_obj.name, remove_hashes) if cache_enabled and blend_cache is not None: diff --git a/config/.htaccess b/config/.htaccess index da71c46..769852a 100644 --- a/config/.htaccess +++ b/config/.htaccess @@ -1,7 +1,8 @@ +<Files webui.cgi> AuthUserFile /var/www/cgi-bin/cobbler/.htpasswd AuthGroupFile /dev/null AuthName "Cobbler WebUI Authentication" AuthType Digest require valid-user - +</Files> diff --git a/tests/tests.py b/tests/tests.py index 9c7fe59..8f98733 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -48,7 +48,9 @@ class BootTest(unittest.TestCase): # Create temp dir - self.topdir = tempfile.mkdtemp(prefix="_cobbler-",dir="/tmp") + self.topdir = "/tmp/cobbler_test" + os.makedirs(self.topdir) + self.fk_initrd = os.path.join(self.topdir, FAKE_INITRD) self.fk_initrd2 = os.path.join(self.topdir, FAKE_INITRD2) self.fk_initrd3 = os.path.join(self.topdir, FAKE_INITRD3) @@ -62,6 +64,7 @@ class BootTest(unittest.TestCase): self.fk_kernel, self.fk_kernel2, self.fk_kernel3 ] for fn in create: f = open(fn,"w+") + f.close() self.make_basic_config() def tearDown(self): @@ -89,6 +92,7 @@ class BootTest(unittest.TestCase): system = self.api.new_system() self.assertTrue(system.set_name("drwily.rdu.redhat.com")) + self.assertTrue(system.set_mac_address("BB:EE:EE:EE:EE:FF","intf0")) self.assertTrue(system.set_profile("testprofile0")) self.assertTrue(self.api.systems().add(system)) self.assertTrue(self.api.systems().find(name="drwily.rdu.redhat.com")) @@ -255,7 +259,6 @@ class Utilities(BootTest): def test_inheritance_and_variable_propogation(self): - # STEP ONE: verify that non-inherited objects behave # correctly with ks_meta (we picked this attribute # because it's a hash and it's a bit harder to handle @@ -450,6 +453,55 @@ class Utilities(BootTest): self.failUnlessRaises(CobblerException, system.set_profile, "profiledoesntexist") self.failUnlessRaises(CobblerException, self.api.systems().add, system) +class SyncContents(BootTest): + + def test_blender_cache_works(self): + + # this is just a file that exists that we don't have to create + fake_file = "/etc/hosts" + + distro = self.api.new_distro() + self.assertTrue(distro.set_name("D1")) + self.assertTrue(distro.set_kernel(fake_file)) + self.assertTrue(distro.set_initrd(fake_file)) + self.assertTrue(self.api.distros().add(distro, with_copy=True)) + self.assertTrue(self.api.distros().find(name="D1")) + + profile = self.api.new_profile() + self.assertTrue(profile.set_name("P1")) + self.assertTrue(profile.set_distro("D1")) + self.assertTrue(profile.set_kickstart(fake_file)) + self.assertTrue(self.api.profiles().add(profile, with_copy=True)) + self.assertTrue(self.api.profiles().find(name="P1")) + + system = self.api.new_system() + self.assertTrue(system.set_name("S1")) + self.assertTrue(system.set_mac_address("BB:EE:EE:EE:EE:FF","intf0")) + self.assertTrue(system.set_profile("P1")) + self.assertTrue(self.api.systems().add(system, with_copy=True)) + self.assertTrue(self.api.systems().find(name="S1")) + + # ensure that the system after being added has the right template data + # in /tftpboot + + converted="01-bb-ee-ee-ee-ee-ff" + + fh = open("/tftpboot/pxelinux.cfg/%s" % converted) + data = fh.read() + self.assertTrue(data.find("kickstarts_sys") != -1) + fh.close() + + # ensure that after sync is applied, the blender cache still allows + # the system data to persist over the profile data in /tftpboot + # (which was an error we had in 0.6.3) + + self.api.sync() + fh = open("/tftpboot/pxelinux.cfg/%s" % converted) + data = fh.read() + self.assertTrue(data.find("kickstarts_sys") != -1) + fh.close() + + class Deletions(BootTest): def test_invalid_delete_profile_doesnt_exist(self): |