forked from ungleich-public/cdist
		
	fails if requirement has illegal object_id
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								2a5465c03c
							
						
					
				
			
			
				commit
				
					
						2246b7496b
					
				
			
		
					 1 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -158,9 +158,6 @@ class Emulator(object):
 | 
			
		|||
                requirement_type_name = requirement_parts[0]
 | 
			
		||||
                requirement_object_id = requirement_parts[1]
 | 
			
		||||
 | 
			
		||||
                # Instantiate type which fails if type does not exist
 | 
			
		||||
                requirement_type = core.Type(self.type_base_path, requirement_type_name)
 | 
			
		||||
 | 
			
		||||
                # FIXME: Add support for omitted object id == singleton
 | 
			
		||||
                #if len(requirement_parts) == 1:
 | 
			
		||||
                #except IndexError:
 | 
			
		||||
| 
						 | 
				
			
			@ -170,6 +167,11 @@ class Emulator(object):
 | 
			
		|||
                # Remove / if existent in object id
 | 
			
		||||
                requirement_object_id = requirement_object_id.lstrip('/')
 | 
			
		||||
 | 
			
		||||
                # Instantiate type which fails if type does not exist
 | 
			
		||||
                requirement_type = core.Type(self.type_base_path, requirement_type_name)
 | 
			
		||||
                # Instantiate object which fails if the object_id is illegal
 | 
			
		||||
                requirement_object = core.Object(requirement_type, self.object_base_path, requirement_object_id)
 | 
			
		||||
 | 
			
		||||
                # Construct cleaned up requirement with only one / :-)
 | 
			
		||||
                requirement = requirement_type_name + '/' + requirement_object_id
 | 
			
		||||
                self.cdist_object.requirements.append(requirement)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue