def save_data(self, content, info=None): super().save_data(content, info) self.repo.git.add(self.path) if info is not None: self.repo.index.commit( ':wrench::construction_worker: [Plumber]\n{}'.format(info)) origin = self.repo.remote(name='origin') origin.push() else: LOG.error('Commit content not provided')
def execute(self): if self.steps is not None: if self.batch: script = ''.join(f'\n {l}' for l in self.steps) result = self._run_script(script=script) self.results.append(result) if result[RETURN_CODE] != 0: LOG.error(create_execution_log(result)) raise ExecutionFailure( 'Step \n{} exited with code {}'.format( script, result[RETURN_CODE])) else: LOG.log(PLUMBER_LOGS, create_execution_log(result)) else: for step in self.steps: result = self._run_script(script=step) self.results.append(result) if result[RETURN_CODE] != 0: LOG.error(create_execution_log(result)) raise ExecutionFailure( 'Step {} exited with code {}'.format( step, result[RETURN_CODE])) else: LOG.log(PLUMBER_LOGS, create_execution_log(result))