Getting "TypeError: 'NoneType' object is not iterable" while doing parallel ssh
<p>I am trying to do parallel ssh on servers. While doing this, i am getting "TypeError: 'NoneType' object is not iterable" this error. Kindly help.</p>

<p>My script is below</p>

<pre><code>from pssh import ParallelSSHClient
from pssh.exceptions import AuthenticationException, UnknownHostException, ConnectionErrorException

def parallelsshjob():
        client = ParallelSSHClient(['10.84.226.72','10.84.226.74'], user = 'root', password = 'XXX')
        try:
                output = client.run_command('racadm getsvctag', sudo=True)
                print output
        except (AuthenticationException, UnknownHostException, ConnectionErrorException):
                pass
        #print output

if __name__ == '__main__':
        parallelsshjob()
</code></pre>

<p>And the Traceback is below</p>

<pre><code>Traceback (most recent call last):
  File "parallelssh.py", line 17, in &lt;module&gt;
    parallelsshjob()
  File "parallelssh.py", line 10, in parallelsshjob
    output = client.run_command('racadm getsvctag', sudo=True)
  File "/Library/Python/2.7/site-packages/pssh/pssh_client.py", line 520, in run_command
    raise ex
TypeError: 'NoneType' object is not iterable
</code></pre>

<p>Help me with the solution and also suggest me to use ssh-agent in this same script. Thanks in advance.</p>

<p>This <a href="https://github.com/pkittenis/parallel-ssh/issues/63" rel="nofollow">was seemingly a regression in the <code>0.92.0</code> version of the library</a> which is now resolved in <a href="https://github.com/pkittenis/parallel-ssh/releases/tag/0.92.1" rel="nofollow">0.92.1</a>. Previous versions also work. OpenSSH config <em>should not</em> be a dependency.</p>

<p>To answer your SSH agent question, if there is one running and enabled in the user session it gets used automatically. If you would prefer to provide a private key programmatically can do the following</p>

<pre><code>from pssh import ParallelSSHClient
from pssh.utils import load_private_key
pkey = load_private_key('my_private_key')
client = ParallelSSHClient(hosts, pkey=pkey)
</code></pre>

<p>Can also provide an agent with multiple keys programmatically, per below</p>

<pre><code>from pssh import ParallelSSHClient
from pssh.utils import load_private_key
from pssh.agent import SSHAgent
pkey = load_private_key('my_private_key')
agent = SSHAgent()
agent.add_key(pkey)
client = ParallelSSHClient(hosts, agent=agent)
</code></pre>

<p><a href="http://parallel-ssh.readthedocs.io/en/latest/pssh_client.html" rel="nofollow">See documentation</a> for more examples.</p>

python ssh ssh-agent