forked from ungleich-public/cdist
		
	Merge branch 'bugfix_issue_102' of git://github.com/dheule/cdist
This commit is contained in:
		
				commit
				
					
						4031209f7b
					
				
			
		
					 5 changed files with 24 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
#
 | 
			
		||||
# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
# 2012-2013 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
# 2014      Daniel Heule     (hda at sfs.biz)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -137,6 +138,22 @@ class ConfigRunTestCase(test.CdistTestCase):
 | 
			
		|||
        with self.assertRaises(cdist.core.cdist_object.MissingObjectIdError):
 | 
			
		||||
            self.config.iterate_until_finished()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def test_dryrun(self):
 | 
			
		||||
        """Test if the dryrun option is working like expected"""
 | 
			
		||||
        drylocal = cdist.exec.local.Local(
 | 
			
		||||
            target_host=self.target_host,
 | 
			
		||||
            base_path=self.local_dir,
 | 
			
		||||
            #exec_path can not derivated from sys.argv in case of unittest ...
 | 
			
		||||
            exec_path=os.path.abspath(os.path.join(my_dir,'../../../scripts/cdist')),
 | 
			
		||||
            initial_manifest=os.path.join(fixtures, 'manifest/dryrun_manifest'),
 | 
			
		||||
            add_conf_dirs=[ fixtures ] )
 | 
			
		||||
 | 
			
		||||
        dryrun = cdist.config.Config(drylocal, self.remote, dry_run=True)
 | 
			
		||||
        dryrun.run()
 | 
			
		||||
        # if we are here, dryrun works like expected
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
# Currently the resolving code will simply detect that this object does
 | 
			
		||||
# not exist. It should probably check if the type is a singleton as well
 | 
			
		||||
# - but maybe only in the emulator - to be discussed.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								cdist/test/config/fixtures/manifest/dryrun_manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/test/config/fixtures/manifest/dryrun_manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
__dryrun_test testit
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/test/config/fixtures/type/__dryrun_test/.keep
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/test/config/fixtures/type/__dryrun_test/.keep
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
# this type is only for testing the dryrun feature, it does nothing usefull
 | 
			
		||||
echo 'echo "This gencode-local script should never be executed >&2"'
 | 
			
		||||
echo 'exit 1'
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
# this type is only for testing the dryrun feature, it does nothing usefull
 | 
			
		||||
echo 'echo "this gencode-remote script should never be executed >&2"'
 | 
			
		||||
echo 'exit 1'
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue