Exemplo n.º 1
0
        def execute():
            # we run this with shell=True since we have to trust whatever
            # our admin configured as command and since we want to allow
            # shell-alike handling here...
            return_code, stdout_lines, stderr_lines = CommandlineCaller().call(
                command_spec["command"], shell=True)

            if not do_ignore and return_code != 0:
                stdout = "\n".join(stdout_lines)
                stderr = "\n".join(stderr_lines)
                error = f"Command for {source}:{command} failed with return code {return_code}:\n\nSTDOUT:\n{stdout}\n\nSTDERR:\n{stderr}"
                logger.warning(prefix_multilines(error, prefix="! "))
                if not do_async:
                    raise CommandFailed(error)
Exemplo n.º 2
0
        def execute():
            # we run this with shell=True since we have to trust whatever
            # our admin configured as command and since we want to allow
            # shell-alike handling here...
            p = sarge.run(command_spec["command"],
                          stdout=sarge.Capture(),
                          stderr=sarge.Capture(),
                          shell=True)

            if not do_ignore and p.returncode != 0:
                returncode = p.returncode
                stdout_text = p.stdout.text
                stderr_text = p.stderr.text

                error = u"Command for {}:{} failed with return code {}:\nSTDOUT: {}\nSTDERR: {}".format(
                    source, command, returncode, stdout_text, stderr_text)
                logger.warn(prefix_multilines(error, prefix=u"! "))
                if not do_async:
                    raise CommandFailed(error)
Exemplo n.º 3
0
		def execute():
			# we run this with shell=True since we have to trust whatever
			# our admin configured as command and since we want to allow
			# shell-alike handling here...
			p = sarge.run(command_spec["command"],
			              stdout=sarge.Capture(),
			              stderr=sarge.Capture(),
			              shell=True)

			if not do_ignore and p.returncode != 0:
				returncode = p.returncode
				stdout_text = p.stdout.text
				stderr_text = p.stderr.text

				error = "Command for {}:{} failed with return code {}:\nSTDOUT: {}\nSTDERR: {}".format(source, command,
				                                                                                       returncode,
				                                                                                       stdout_text,
				                                                                                       stderr_text)
				logger.warn(prefix_multilines(error, prefix="! "))
				if not do_async:
					raise CommandFailed(error)