fix autorequire dependency handling

- inherit explicit requirements that the user defined himself
- but _not_ implicit requirements that cdist added for autorequire

Changes:
- added new .autorequire property to CdistObject to keep track of implicit autorequire dependencies
- Emulator appends implicit requirements to this .autorequire property
- DependencyResolver preprocess these .autorequire properties before resolving normal dependencies
- refactored and documented DependencyResolver so it's clearer what happens and easier to use from tests
- update test cases to match new DependencyResolver behaviour

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2012-05-03 10:16:08 +02:00
commit 7d61b77708
18 changed files with 156 additions and 37 deletions

View file

@ -114,7 +114,8 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase):
self.manifest = core.Manifest(self.target_host, self.local)
def tearDown(self):
shutil.rmtree(self.temp_dir)
pass
#shutil.rmtree(self.temp_dir)
def test_autorequire(self):
initial_manifest = os.path.join(self.local.manifest_path, "init")
@ -123,7 +124,7 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase):
cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'singleton')
self.manifest.run_type_manifest(cdist_object)
expected = ['__planet/Saturn', '__moon/Prometheus']
self.assertEqual(sorted(cdist_object.requirements), sorted(expected))
self.assertEqual(sorted(cdist_object.autorequire), sorted(expected))
class ArgumentsTestCase(test.CdistTestCase):