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

queueObj['command_output'] Type Error #1

Open
heqin5136 opened this issue Jan 17, 2018 · 0 comments
Open

queueObj['command_output'] Type Error #1

heqin5136 opened this issue Jan 17, 2018 · 0 comments

Comments

@heqin5136
Copy link

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()


Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant