unix1986 / parallel-ssh

Automatically exported from code.google.com/p/parallel-ssh
Other
0 stars 0 forks source link

Only one option can be set with PSSH_OPTIONS #68

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. export PSSH_OPTIONS="IdentityFile=/var/foo StrictHostKeyChecking=no"
2. parallel-ssh -i -H localhost env
=> [FAILURE] localhost Exited with error code 255

What is the expected output? What do you see instead?
I would expect to see the output of the 'env' command.

What version of the product are you using? On what operating system?
Ubuntu Oneiric, pssh 2.2.2-0ubuntu1

Please provide any additional information below.
The array holding the ssh command & arguments looks like this:
['ssh', 'localhost', '-o', 'NumberOfPasswordPrompts=1', '-o', 
'SendEnv=PSSH_NODENUM', '-o', 'IdentityFile=/tmp/bar StrictHostKeyChecking=no']

You can see the PSSH_OPTIONS are translated to a single -o argument.
There's probably more to it than just splitting the string at the space (what 
if there is an intended space, like IdentityFile=/home/x/my documents/foo), so 
I don't have a meaningful suggestion how to do it better.

Original issue reported on code.google.com by ka...@vervaeke.info on 27 Mar 2012 at 6:55

GoogleCodeExporter commented 8 years ago
Additionally, setting PSSH_OPTIONS breaks parallel-rsync:

in do_prsync, you get
ssh => ['ssh', '-o', ['IdentityFile=/home/karel/.ssh/id_rsa_whirr']]

At this line, you get an error because ssh[2] is a list instead of a string:
        cmd = ['rsync', '-e', ' '.join(ssh)]

Original comment by ka...@vervaeke.info on 27 Mar 2012 at 8:15

GoogleCodeExporter commented 8 years ago
It looks like in comment #1, you describe a legitimate bug. As for the 
PSSH_OPTIONS, that's mostly just a weakness in using environment variables for 
specifying options. In fact, the environment variables aren't described in the 
man page, in the hope of subtly discouraging their use.

Using the command-line arguments is the recommended way to set ssh options. The 
man page points out a tip for frequently specified options:

    If  you  have a set of hosts that you connect to frequently with specific
    options, it may be helpful to create an alias such as:
        alias pssh_servers="pssh -h /path/to/server_list.txt -l root -A"

Original comment by amcna...@gmail.com on 28 Mar 2012 at 4:00

GoogleCodeExporter commented 8 years ago
Apparently my pssh package provides two man pages. One for 'pssh' and one for 
'parallel-ssh'. The latter one does mention the environment variables. It could 
be a packaging problem by whoever produced the ubuntu package.

I already have functions for calling pssh.
function mypssh() {
  role=$1
  shift
  pssh -h /path/to/${role}.txt [someotherargs] $@
}
I was just looking for the most elegant solution. I guess I'll using -O and -x 
to control ssh args.

Original comment by ka...@vervaeke.info on 29 Mar 2012 at 7:06

GoogleCodeExporter commented 8 years ago
That's a weird packaging issue. I know that there are some problems because 
more than one package uses the name pssh.

I think your functions for calling pssh are far more elegant than environment 
variables. So, in my opinion, you're already on the right track.

Original comment by amcna...@gmail.com on 31 Mar 2012 at 6:04