def check_syntax(self, ip_type, filename): out, err, ret = run_command("{} -{} -t -cf {}".format( self.dhcpd, ip_type, os.path.join(self.stage_dir, filename))) if ret != 0: log_msg = 'DHCP build failed due to a syntax error' exception_msg = log_msg + ('\n{0} said:\n{1}'.format( self.dhcpd, err)) self.error(log_msg)
def run_command(self, command, log=True, failure_msg=None): if log: command_logger = self.log_debug failure_logger = self.log_err else: command_logger = None failure_logger = None return run_command(command, command_logger=command_logger, failure_logger=failure_logger, failure_msg=failure_msg)
def check_syntax(self): out, err, ret = run_command("{0} -t -cf {1}".format( self.dhcpd, os.path.join(self.stage_dir, self.check_file))) if ret != 0: log_msg = 'DHCP build failed due to a syntax error' exception_msg = log_msg + ('\n{0} said:\n{1}'.format( self.dhcpd, err)) self.log_err(log_msg, to_stderr=False) raise Exception(exception_msg)
def check_syntax(self, ip_type, filename): out, err, ret = run_command("{} -{} -t -cf {}".format( self.dhcpd, ip_type, os.path.join(self.stage_dir, filename) )) if ret != 0: log_msg = 'DHCP build failed due to a syntax error' exception_msg = log_msg + ('\n{0} said:\n{1}' .format(self.dhcpd, err)) self.error(log_msg)
def _run_command(self, command, log=True, failure_msg=None, ignore_failure=False): if log: command_logger = self._log failure_logger = lambda msg: self._log(msg, log_level='LOG_ERR') else: command_logger, failure_logger = None, None return run_command( command, command_logger=command_logger, failure_logger=failure_logger, failure_msg=failure_msg, ignore_failure=ignore_failure)
def _run_command(self, command, log=True, failure_msg=None, ignore_failure=False): if log: command_logger = self._log failure_logger = lambda msg: self._log(msg, log_level='LOG_ERR') else: command_logger, failure_logger = None, None return run_command(command, command_logger=command_logger, failure_logger=failure_logger, failure_msg=failure_msg, ignore_failure=ignore_failure)
def _run_command(self, command, ignore_failure=False): return run_command(command, logger=self.logger, ignore_failure=ignore_failure)
def clone(self, source, dest): run_command('git clone {0} {1}'.format(source, dest)) with ChdirHandler(dest): self._update_git_config(self.config)
def run_command(self, command, failure_msg=None): return run_command(command, logger=self, failure_msg=failure_msg)