print warning in case dry run is activated
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								5bad25cd6d
							
						
					
				
			
			
				commit
				
					
						5f318d5de3
					
				
			
		
					 1 changed files with 5 additions and 7 deletions
				
			
		| 
						 | 
					@ -144,11 +144,6 @@ class ConfigInstall(object):
 | 
				
			||||||
    def object_run(self, cdist_object, dry_run=False):
 | 
					    def object_run(self, cdist_object, dry_run=False):
 | 
				
			||||||
        """Run gencode and code for an object"""
 | 
					        """Run gencode and code for an object"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self.dry_run:
 | 
					 | 
				
			||||||
            dry_run = ""
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            dry_run = " (dry run)"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.log.debug("Trying to run object %s" % (cdist_object.name))
 | 
					        self.log.debug("Trying to run object %s" % (cdist_object.name))
 | 
				
			||||||
        if cdist_object.state == core.CdistObject.STATE_DONE:
 | 
					        if cdist_object.state == core.CdistObject.STATE_DONE:
 | 
				
			||||||
            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)
 | 
				
			||||||
| 
						 | 
					@ -156,19 +151,22 @@ class ConfigInstall(object):
 | 
				
			||||||
        cdist_type = cdist_object.cdist_type
 | 
					        cdist_type = cdist_object.cdist_type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Generate
 | 
					        # Generate
 | 
				
			||||||
        self.log.info("Generating and executing code for %s%s" % (cdist_object.name, dry_run))
 | 
					        self.log.info("Generating and executing code for %s" % (cdist_object.name))
 | 
				
			||||||
        cdist_object.code_local = self.code.run_gencode_local(cdist_object)
 | 
					        cdist_object.code_local = self.code.run_gencode_local(cdist_object)
 | 
				
			||||||
        cdist_object.code_remote = self.code.run_gencode_remote(cdist_object)
 | 
					        cdist_object.code_remote = self.code.run_gencode_remote(cdist_object)
 | 
				
			||||||
        if cdist_object.code_local or cdist_object.code_remote:
 | 
					        if cdist_object.code_local or cdist_object.code_remote:
 | 
				
			||||||
            cdist_object.changed = True
 | 
					            cdist_object.changed = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Execute
 | 
					        # Execute
 | 
				
			||||||
        if not dry_run:
 | 
					        if not self.dry_run:
 | 
				
			||||||
            if cdist_object.code_local:
 | 
					            if cdist_object.code_local:
 | 
				
			||||||
                self.code.run_code_local(cdist_object)
 | 
					                self.code.run_code_local(cdist_object)
 | 
				
			||||||
            if cdist_object.code_remote:
 | 
					            if cdist_object.code_remote:
 | 
				
			||||||
                self.code.transfer_code_remote(cdist_object)
 | 
					                self.code.transfer_code_remote(cdist_object)
 | 
				
			||||||
                self.code.run_code_remote(cdist_object)
 | 
					                self.code.run_code_remote(cdist_object)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            self.log.info("Skipping code execution due to DRY RUN")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # 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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue