forked from ungleich-public/cdist
		
	begin rename Object => CdistObject
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								15fb097464
							
						
					
				
			
			
				commit
				
					
						4be37f6e93
					
				
			
		
					 9 changed files with 37 additions and 39 deletions
				
			
		| 
						 | 
					@ -89,9 +89,9 @@ class ConfigInstall(object):
 | 
				
			||||||
        new_objects_created = True
 | 
					        new_objects_created = True
 | 
				
			||||||
        while new_objects_created:
 | 
					        while new_objects_created:
 | 
				
			||||||
            new_objects_created = False
 | 
					            new_objects_created = False
 | 
				
			||||||
            for cdist_object in core.Object.list_objects(self.local.object_path,
 | 
					            for cdist_object in core.CdistObject.list_objects(self.local.object_path,
 | 
				
			||||||
                                                         self.local.type_path):
 | 
					                                                         self.local.type_path):
 | 
				
			||||||
                if cdist_object.state == core.Object.STATE_PREPARED:
 | 
					                if cdist_object.state == core.CdistObject.STATE_PREPARED:
 | 
				
			||||||
                    self.log.debug("Skipping re-prepare of object %s", cdist_object)
 | 
					                    self.log.debug("Skipping re-prepare of object %s", cdist_object)
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
| 
						 | 
					@ -103,12 +103,12 @@ class ConfigInstall(object):
 | 
				
			||||||
        self.log.info("Running manifest and explorers for " + cdist_object.name)
 | 
					        self.log.info("Running manifest and explorers for " + cdist_object.name)
 | 
				
			||||||
        self.explorer.run_type_explorers(cdist_object)
 | 
					        self.explorer.run_type_explorers(cdist_object)
 | 
				
			||||||
        self.manifest.run_type_manifest(cdist_object)
 | 
					        self.manifest.run_type_manifest(cdist_object)
 | 
				
			||||||
        cdist_object.state = core.Object.STATE_PREPARED
 | 
					        cdist_object.state = core.CdistObject.STATE_PREPARED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def object_run(self, cdist_object):
 | 
					    def object_run(self, cdist_object):
 | 
				
			||||||
        """Run gencode and code for an object"""
 | 
					        """Run gencode and code for an object"""
 | 
				
			||||||
        self.log.debug("Trying to run object " + cdist_object.name)
 | 
					        self.log.debug("Trying to run object " + cdist_object.name)
 | 
				
			||||||
        if cdist_object.state == core.Object.STATE_DONE:
 | 
					        if cdist_object.state == core.CdistObject.STATE_DONE:
 | 
				
			||||||
            # TODO: remove once we are sure that this really never happens.
 | 
					            # TODO: remove once we are sure that this really never happens.
 | 
				
			||||||
            raise cdist.Error("Attempting to run an already finished object: %s", cdist_object)
 | 
					            raise cdist.Error("Attempting to run an already finished object: %s", cdist_object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,13 +130,13 @@ class ConfigInstall(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Mark this object as done
 | 
					        # Mark this object as done
 | 
				
			||||||
        self.log.debug("Finishing run of " + cdist_object.name)
 | 
					        self.log.debug("Finishing run of " + cdist_object.name)
 | 
				
			||||||
        cdist_object.state = core.Object.STATE_DONE
 | 
					        cdist_object.state = core.CdistObject.STATE_DONE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def stage_run(self):
 | 
					    def stage_run(self):
 | 
				
			||||||
        """The final (and real) step of deployment"""
 | 
					        """The final (and real) step of deployment"""
 | 
				
			||||||
        self.log.info("Generating and executing code")
 | 
					        self.log.info("Generating and executing code")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        objects = core.Object.list_objects(
 | 
					        objects = core.CdistObject.list_objects(
 | 
				
			||||||
            self.local.object_path,
 | 
					            self.local.object_path,
 | 
				
			||||||
            self.local.type_path)
 | 
					            self.local.type_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,7 @@ class IllegalObjectIdError(cdist.Error):
 | 
				
			||||||
        return '%s: %s' % (self.message, self.object_id)
 | 
					        return '%s: %s' % (self.message, self.object_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Object(object):
 | 
					class CdistObject(object):
 | 
				
			||||||
    """Represents a cdist object.
 | 
					    """Represents a cdist object.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    All interaction with objects in cdist should be done through this class.
 | 
					    All interaction with objects in cdist should be done through this class.
 | 
				
			||||||
| 
						 | 
					@ -124,7 +124,7 @@ class Object(object):
 | 
				
			||||||
        self.parameter_path = os.path.join(self.path, "parameter")
 | 
					        self.parameter_path = os.path.join(self.path, "parameter")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        return '<Object %s>' % self.name
 | 
					        return '<CdistObject %s>' % self.name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __eq__(self, other):
 | 
					    def __eq__(self, other):
 | 
				
			||||||
        """define equality as 'name is the same'"""
 | 
					        """define equality as 'name is the same'"""
 | 
				
			||||||
| 
						 | 
					@ -142,7 +142,7 @@ class Object(object):
 | 
				
			||||||
        Mainly intended to create objects when resolving requirements.
 | 
					        Mainly intended to create objects when resolving requirements.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        e.g:
 | 
					        e.g:
 | 
				
			||||||
            <Object __foo/bar>.object_from_name('__other/object') -> <Object __other/object>
 | 
					            <CdistObject __foo/bar>.object_from_name('__other/object') -> <CdistObject __other/object>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        type_path = self.type.base_path
 | 
					        type_path = self.type.base_path
 | 
				
			||||||
| 
						 | 
					@ -155,8 +155,6 @@ class Object(object):
 | 
				
			||||||
        Remove leading and trailing slash (one only)
 | 
					        Remove leading and trailing slash (one only)
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        print(self.__repr__())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Remove leading slash
 | 
					        # Remove leading slash
 | 
				
			||||||
        if self.object_id[0] == '/':
 | 
					        if self.object_id[0] == '/':
 | 
				
			||||||
            self.object_id = self.object_id[1:]
 | 
					            self.object_id = self.object_id[1:]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,7 @@ class Emulator(object):
 | 
				
			||||||
            self.object_id = self.object_id.lstrip('/')
 | 
					            self.object_id = self.object_id.lstrip('/')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Instantiate the cdist object we are defining
 | 
					        # Instantiate the cdist object we are defining
 | 
				
			||||||
        self.cdist_object = core.Object(self.cdist_type, self.object_base_path, self.object_id)
 | 
					        self.cdist_object = core.CdistObject(self.cdist_type, self.object_base_path, self.object_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Create object with given parameters
 | 
					        # Create object with given parameters
 | 
				
			||||||
        self.parameters = {}
 | 
					        self.parameters = {}
 | 
				
			||||||
| 
						 | 
					@ -154,13 +154,13 @@ class Emulator(object):
 | 
				
			||||||
                if len(requirement) == 0:
 | 
					                if len(requirement) == 0:
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                requirement_type_name, requirement_object_id = core.Object.split_name(requirement)
 | 
					                requirement_type_name, requirement_object_id = core.CdistObject.split_name(requirement)
 | 
				
			||||||
                # Instantiate type which fails if type does not exist
 | 
					                # Instantiate type which fails if type does not exist
 | 
				
			||||||
                requirement_type = core.Type(self.type_base_path, requirement_type_name)
 | 
					                requirement_type = core.Type(self.type_base_path, requirement_type_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if requirement_object_id:
 | 
					                if requirement_object_id:
 | 
				
			||||||
                    # Validate object_id if any
 | 
					                    # Validate object_id if any
 | 
				
			||||||
                    core.Object.validate_object_id(requirement_object_id)
 | 
					                    core.CdistObject.validate_object_id(requirement_object_id)
 | 
				
			||||||
                elif not requirement_type.is_singleton:
 | 
					                elif not requirement_type.is_singleton:
 | 
				
			||||||
                    # Only singeltons have no object_id
 | 
					                    # Only singeltons have no object_id
 | 
				
			||||||
                    raise IllegalRequirementError(requirement, "Missing object_id and type is not a singleton.")
 | 
					                    raise IllegalRequirementError(requirement, "Missing object_id and type is not a singleton.")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@ class CodeTestCase(test.CdistTestCase):
 | 
				
			||||||
        self.code = code.Code(self.target_host, self.local, self.remote)
 | 
					        self.code = code.Code(self.target_host, self.local, self.remote)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.cdist_type = core.Type(self.local.type_path, '__dump_environment')
 | 
					        self.cdist_type = core.Type(self.local.type_path, '__dump_environment')
 | 
				
			||||||
        self.cdist_object = core.Object(self.cdist_type, self.local.object_path, 'whatever')
 | 
					        self.cdist_object = core.CdistObject(self.cdist_type, self.local.object_path, 'whatever')
 | 
				
			||||||
        self.cdist_object.create()
 | 
					        self.cdist_object.create()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.log = logging.getLogger("cdist")
 | 
					        self.log = logging.getLogger("cdist")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,7 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase):
 | 
				
			||||||
        initial_manifest = os.path.join(self.local.manifest_path, "init")
 | 
					        initial_manifest = os.path.join(self.local.manifest_path, "init")
 | 
				
			||||||
        self.manifest.run_initial_manifest(initial_manifest)
 | 
					        self.manifest.run_initial_manifest(initial_manifest)
 | 
				
			||||||
        cdist_type = core.Type(self.local.type_path, '__saturn')
 | 
					        cdist_type = core.Type(self.local.type_path, '__saturn')
 | 
				
			||||||
        cdist_object = core.Object(cdist_type, self.local.object_path, 'singleton')
 | 
					        cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'singleton')
 | 
				
			||||||
        self.manifest.run_type_manifest(cdist_object)
 | 
					        self.manifest.run_type_manifest(cdist_object)
 | 
				
			||||||
        expected = ['__planet/Saturn', '__moon/Prometheus']
 | 
					        expected = ['__planet/Saturn', '__moon/Prometheus']
 | 
				
			||||||
        self.assertEqual(sorted(cdist_object.requirements), sorted(expected))
 | 
					        self.assertEqual(sorted(cdist_object.requirements), sorted(expected))
 | 
				
			||||||
| 
						 | 
					@ -157,5 +157,5 @@ class ArgumentsWithDashesTestCase(test.CdistTestCase):
 | 
				
			||||||
        emu.run()
 | 
					        emu.run()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cdist_type = core.Type(self.local.type_path, '__arguments_with_dashes')
 | 
					        cdist_type = core.Type(self.local.type_path, '__arguments_with_dashes')
 | 
				
			||||||
        cdist_object = core.Object(cdist_type, self.local.object_path, 'some-id')
 | 
					        cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'some-id')
 | 
				
			||||||
        self.assertTrue('with-dash' in cdist_object.parameters)
 | 
					        self.assertTrue('with-dash' in cdist_object.parameters)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,7 +110,7 @@ class ExplorerClassTestCase(test.CdistTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_transfer_object_parameters(self):
 | 
					    def test_transfer_object_parameters(self):
 | 
				
			||||||
        cdist_type = core.Type(self.local.type_path, '__test_type')
 | 
					        cdist_type = core.Type(self.local.type_path, '__test_type')
 | 
				
			||||||
        cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever')
 | 
					        cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'whatever')
 | 
				
			||||||
        cdist_object.create()
 | 
					        cdist_object.create()
 | 
				
			||||||
        cdist_object.parameters = {'first': 'first value', 'second': 'second value'}
 | 
					        cdist_object.parameters = {'first': 'first value', 'second': 'second value'}
 | 
				
			||||||
        self.explorer.transfer_object_parameters(cdist_object)
 | 
					        self.explorer.transfer_object_parameters(cdist_object)
 | 
				
			||||||
| 
						 | 
					@ -120,14 +120,14 @@ class ExplorerClassTestCase(test.CdistTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_run_type_explorer(self):
 | 
					    def test_run_type_explorer(self):
 | 
				
			||||||
        cdist_type = core.Type(self.local.type_path, '__test_type')
 | 
					        cdist_type = core.Type(self.local.type_path, '__test_type')
 | 
				
			||||||
        cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever')
 | 
					        cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'whatever')
 | 
				
			||||||
        self.explorer.transfer_type_explorers(cdist_type)
 | 
					        self.explorer.transfer_type_explorers(cdist_type)
 | 
				
			||||||
        output = self.explorer.run_type_explorer('world', cdist_object)
 | 
					        output = self.explorer.run_type_explorer('world', cdist_object)
 | 
				
			||||||
        self.assertEqual(output, 'hello\n')
 | 
					        self.assertEqual(output, 'hello\n')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_run_type_explorers(self):
 | 
					    def test_run_type_explorers(self):
 | 
				
			||||||
        cdist_type = core.Type(self.local.type_path, '__test_type')
 | 
					        cdist_type = core.Type(self.local.type_path, '__test_type')
 | 
				
			||||||
        cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever')
 | 
					        cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'whatever')
 | 
				
			||||||
        cdist_object.create()
 | 
					        cdist_object.create()
 | 
				
			||||||
        self.explorer.run_type_explorers(cdist_object)
 | 
					        self.explorer.run_type_explorers(cdist_object)
 | 
				
			||||||
        self.assertEqual(cdist_object.explorers, {'world': 'hello'})
 | 
					        self.assertEqual(cdist_object.explorers, {'world': 'hello'})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ class ManifestTestCase(test.CdistTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_type_manifest_environment(self):
 | 
					    def test_type_manifest_environment(self):
 | 
				
			||||||
        cdist_type = core.Type(self.local.type_path, '__dump_environment')
 | 
					        cdist_type = core.Type(self.local.type_path, '__dump_environment')
 | 
				
			||||||
        cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever')
 | 
					        cdist_object = core.CdistObject(cdist_type, self.local.object_path, 'whatever')
 | 
				
			||||||
        handle, output_file = self.mkstemp(dir=self.temp_dir)
 | 
					        handle, output_file = self.mkstemp(dir=self.temp_dir)
 | 
				
			||||||
        os.close(handle)
 | 
					        os.close(handle)
 | 
				
			||||||
        os.environ['__cdist_test_out'] = output_file
 | 
					        os.environ['__cdist_test_out'] = output_file
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,19 +34,19 @@ type_base_path = op.join(fixtures, 'type')
 | 
				
			||||||
class ObjectClassTestCase(test.CdistTestCase):
 | 
					class ObjectClassTestCase(test.CdistTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_list_object_names(self):
 | 
					    def test_list_object_names(self):
 | 
				
			||||||
        object_names = list(core.Object.list_object_names(object_base_path))
 | 
					        object_names = list(core.CdistObject.list_object_names(object_base_path))
 | 
				
			||||||
        self.assertEqual(object_names, ['__first/man', '__second/on-the', '__third/moon'])
 | 
					        self.assertEqual(object_names, ['__first/man', '__second/on-the', '__third/moon'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_list_type_names(self):
 | 
					    def test_list_type_names(self):
 | 
				
			||||||
        type_names = list(core.Object.list_type_names(object_base_path))
 | 
					        type_names = list(core.CdistObject.list_type_names(object_base_path))
 | 
				
			||||||
        self.assertEqual(type_names, ['__first', '__second', '__third'])
 | 
					        self.assertEqual(type_names, ['__first', '__second', '__third'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_list_objects(self):
 | 
					    def test_list_objects(self):
 | 
				
			||||||
        objects = list(core.Object.list_objects(object_base_path, type_base_path))
 | 
					        objects = list(core.CdistObject.list_objects(object_base_path, type_base_path))
 | 
				
			||||||
        objects_expected = [
 | 
					        objects_expected = [
 | 
				
			||||||
            core.Object(core.Type(type_base_path, '__first'), object_base_path, 'man'),
 | 
					            core.CdistObject(core.Type(type_base_path, '__first'), object_base_path, 'man'),
 | 
				
			||||||
            core.Object(core.Type(type_base_path, '__second'), object_base_path, 'on-the'),
 | 
					            core.CdistObject(core.Type(type_base_path, '__second'), object_base_path, 'on-the'),
 | 
				
			||||||
            core.Object(core.Type(type_base_path, '__third'), object_base_path, 'moon'),
 | 
					            core.CdistObject(core.Type(type_base_path, '__third'), object_base_path, 'moon'),
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
        self.assertEqual(objects, objects_expected)
 | 
					        self.assertEqual(objects, objects_expected)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,18 +56,18 @@ class ObjectIdTestCase(test.CdistTestCase):
 | 
				
			||||||
        cdist_type = core.Type(type_base_path, '__third')
 | 
					        cdist_type = core.Type(type_base_path, '__third')
 | 
				
			||||||
        illegal_object_id = '/object_id/may/not/start/with/slash'
 | 
					        illegal_object_id = '/object_id/may/not/start/with/slash'
 | 
				
			||||||
        with self.assertRaises(core.IllegalObjectIdError):
 | 
					        with self.assertRaises(core.IllegalObjectIdError):
 | 
				
			||||||
            core.Object(cdist_type, object_base_path, illegal_object_id)
 | 
					            core.CdistObject(cdist_type, object_base_path, illegal_object_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_object_id_contains_object_marker(self):
 | 
					    def test_object_id_contains_object_marker(self):
 | 
				
			||||||
        cdist_type = core.Type(type_base_path, '__third')
 | 
					        cdist_type = core.Type(type_base_path, '__third')
 | 
				
			||||||
        illegal_object_id = 'object_id/may/not/contain/%s/anywhere' % core.OBJECT_MARKER
 | 
					        illegal_object_id = 'object_id/may/not/contain/%s/anywhere' % core.OBJECT_MARKER
 | 
				
			||||||
        with self.assertRaises(core.IllegalObjectIdError):
 | 
					        with self.assertRaises(core.IllegalObjectIdError):
 | 
				
			||||||
            core.Object(cdist_type, object_base_path, illegal_object_id)
 | 
					            core.CdistObject(cdist_type, object_base_path, illegal_object_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_object_id_contains_object_marker_string(self):
 | 
					    def test_object_id_contains_object_marker_string(self):
 | 
				
			||||||
        cdist_type = core.Type(type_base_path, '__third')
 | 
					        cdist_type = core.Type(type_base_path, '__third')
 | 
				
			||||||
        illegal_object_id = 'object_id/may/contain_%s_in_filename' % core.OBJECT_MARKER
 | 
					        illegal_object_id = 'object_id/may/contain_%s_in_filename' % core.OBJECT_MARKER
 | 
				
			||||||
        core.Object(cdist_type, object_base_path, illegal_object_id)
 | 
					        core.CdistObject(cdist_type, object_base_path, illegal_object_id)
 | 
				
			||||||
        # if we get here, the test passed
 | 
					        # if we get here, the test passed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,7 @@ class ObjectTestCase(test.CdistTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def setUp(self):
 | 
					    def setUp(self):
 | 
				
			||||||
        self.cdist_type = core.Type(type_base_path, '__third')
 | 
					        self.cdist_type = core.Type(type_base_path, '__third')
 | 
				
			||||||
        self.cdist_object = core.Object(self.cdist_type, object_base_path, 'moon') 
 | 
					        self.cdist_object = core.CdistObject(self.cdist_type, object_base_path, 'moon') 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def tearDown(self):
 | 
					    def tearDown(self):
 | 
				
			||||||
        self.cdist_object.changed = False
 | 
					        self.cdist_object.changed = False
 | 
				
			||||||
| 
						 | 
					@ -159,16 +159,16 @@ class ObjectTestCase(test.CdistTestCase):
 | 
				
			||||||
        self.assertEqual(self.cdist_object.state, '')
 | 
					        self.assertEqual(self.cdist_object.state, '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_state_prepared(self):
 | 
					    def test_state_prepared(self):
 | 
				
			||||||
        self.cdist_object.state = core.Object.STATE_PREPARED
 | 
					        self.cdist_object.state = core.CdistObject.STATE_PREPARED
 | 
				
			||||||
        self.assertEqual(self.cdist_object.state, core.Object.STATE_PREPARED)
 | 
					        self.assertEqual(self.cdist_object.state, core.CdistObject.STATE_PREPARED)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_state_running(self):
 | 
					    def test_state_running(self):
 | 
				
			||||||
        self.cdist_object.state = core.Object.STATE_RUNNING
 | 
					        self.cdist_object.state = core.CdistObject.STATE_RUNNING
 | 
				
			||||||
        self.assertEqual(self.cdist_object.state, core.Object.STATE_RUNNING)
 | 
					        self.assertEqual(self.cdist_object.state, core.CdistObject.STATE_RUNNING)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_state_done(self):
 | 
					    def test_state_done(self):
 | 
				
			||||||
        self.cdist_object.state = core.Object.STATE_DONE
 | 
					        self.cdist_object.state = core.CdistObject.STATE_DONE
 | 
				
			||||||
        self.assertEqual(self.cdist_object.state, core.Object.STATE_DONE)
 | 
					        self.assertEqual(self.cdist_object.state, core.CdistObject.STATE_DONE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_source(self):
 | 
					    def test_source(self):
 | 
				
			||||||
        self.assertEqual(list(self.cdist_object.source), [])
 | 
					        self.assertEqual(list(self.cdist_object.source), [])
 | 
				
			||||||
| 
						 | 
					@ -195,6 +195,6 @@ class ObjectTestCase(test.CdistTestCase):
 | 
				
			||||||
        self.cdist_object.code_remote = 'Hello World'
 | 
					        self.cdist_object.code_remote = 'Hello World'
 | 
				
			||||||
        other_name = '__first/man'
 | 
					        other_name = '__first/man'
 | 
				
			||||||
        other_object = self.cdist_object.object_from_name(other_name)
 | 
					        other_object = self.cdist_object.object_from_name(other_name)
 | 
				
			||||||
        self.assertTrue(isinstance(other_object, core.Object))
 | 
					        self.assertTrue(isinstance(other_object, core.CdistObject))
 | 
				
			||||||
        self.assertEqual(other_object.type.name, '__first')
 | 
					        self.assertEqual(other_object.type.name, '__first')
 | 
				
			||||||
        self.assertEqual(other_object.object_id, 'man')
 | 
					        self.assertEqual(other_object.object_id, 'man')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ type_base_path = op.join(fixtures, 'type')
 | 
				
			||||||
class ResolverTestCase(test.CdistTestCase):
 | 
					class ResolverTestCase(test.CdistTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def setUp(self):
 | 
					    def setUp(self):
 | 
				
			||||||
        self.objects = list(core.Object.list_objects(object_base_path, type_base_path))
 | 
					        self.objects = list(core.CdistObject.list_objects(object_base_path, type_base_path))
 | 
				
			||||||
        self.object_index = dict((o.name, o) for o in self.objects)
 | 
					        self.object_index = dict((o.name, o) for o in self.objects)
 | 
				
			||||||
        self.dependency_resolver = resolver.DependencyResolver(self.objects)
 | 
					        self.dependency_resolver = resolver.DependencyResolver(self.objects)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue