Skip to content
This repository was archived by the owner on Dec 20, 2022. It is now read-only.
This repository was archived by the owner on Dec 20, 2022. It is now read-only.

queueObj['command_output'] Type Error #1

@heqin5136

Description

@heqin5136

The type of queueObj['command_output'] may be a string or a list, but it may also be the SSHException type

if isinstance(queueObj['command_output'], str):
    pass # Since it is a string we'll assume it is already formatted properly
elif len(queueObj['command_output']) > 1: # Only prepend 'index: ' if we were passed more than one command
    queueObj['command_output'] = "\n".join(["%s: %s" % (index, command) for index, command in enumerate(queueObj['command_output'])])
else:
    queueObj['command_output'] = "\n".join(queueObj['command_output'])

Error

File "/usr/sbin/sshpt", line 123, in run
   self.writeOut(queueObj)
File "/usr/sbin/sshpt", line 106, in writeOut
  elif len(queueObj['command_output']) > 1: # Only prepend 'index: ' if we were passed more than one command
TypeError: object of type 'SSHException' has no len()


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions