У меня есть этот код, который отлично работает, но он печатает ПРЕДУПРЕЖДЕНИЕ, и я хочу, чтобы они не отображались, так как это вызывает путаницу в журналах
try:
p = Protocol(
endpoint='http://{}:{}/wsman'.format("10.x.x.4x", "5xxxx"),
transport='ntlm',
username='xxxx',
password='xxxx',
server_cert_validation='ignore')
shell_id = p.open_shell()
command_id = p.run_command(shell_id, command, command_args)
std_out, std_err, status_code = p.get_command_output(shell_id, command_id)
p.cleanup_command(shell_id, command_id)
p.close_shell(shell_id)
if status_code == 1:
logger.error("execute_win_command failed: %s %s %s" % (std_out, std_err, status_code))
return False
logger.info(
"execute_win_command success: %s %s %s" % (std_out, connection_map['ip'], connection_map['port']))
except Exception as err:
if std_err is not None and status_code is not None and std_out is not None:
logger.error("execute_win_command %s %s %s" % (std_out, std_err, status_code))
logger.error("At %s exception: %s - %s :%s" %
("execute_win_command", current_user.username, repr(err), traceback.format_exc()))
return False
Я получаю это: