Seth Haines wrote:
> 
> Andrea,
> 
> This was on a 3.8.1 based server.

This bug has been fixed in 4.0.0.

Look at the diff below. In particular these two lines should resolve
your problem:

+       $cmd =~ s/"/\\"/g;
+       $cmd = "\"$cmd\"";

Maybe you should consider to move to 4.0.2 or if you don't want to
update you could try to apply the patch manually (BTW not the following
patch, just the two lines above otherwise, if I remember well, also some
changes in lib/SystemImager/Hostrange.pm module are needed).

-Andrea

Index: si_psh
===================================================================
--- si_psh      (.../3.8.1/sbin/si_psh) (revision 4415)
+++ si_psh      (.../4.0.0/sbin/si_psh) (revision 4415)
@@ -36,16 +36,26 @@
 
  --hosts, -n=HOST_LIST  List of target nodes. List can be separated by
                         comma, spaces or new line and can include
-                        ranges (e.g. "node001-node256,node300 node400").
+                        ranges or host groups
+                        (e.g. "node001-node256 node300,Login,Storage").
+                        Host groups must be defined by si_clusterconfig(8).
 
  --hosts-file, -f=FILE  File that contains the list of the target host.
-                        Every line can include one or more ranges
-                        (e.g. "node001-node256,node300 node400").
+                        Every line can include one or more ranges or
+                        host groups
+                        (e.g. "node001-node256 node300,Login,Storage").
+                        Host groups must be defined by si_clusterconfig(8).
 
  --timeout, -t=NUM      Set the timeout of the ssh sessions (default=15s).
 
  --ssh-user, -l=USER    Run the command as user USER.
 
+ --imaging, -i          Run the command on imaging clients (that have a ssh
+                       deamon enabled - add SSHD=y in the installation boot
+                        parameters and include a valid authorized_keys into
+                       the initrd.img). See si_mkbootpackage(8) or
+                        si_prepareclient(8) for more details.
+
 EOF
 
 Getopt::Long::Configure("posix_default");
@@ -60,6 +70,7 @@
        "hosts-file|f=s"        => \my $hostlist_file,
        "timeout|t=i"           => \my $timeout,
        "ssh-user|l=s"          => \my $ssh_user,
+       "imaging|i"             => \my $imaging,
 ) or die("$help_info");
 
 ### BEGIN evaluate commad line options ###
@@ -79,27 +90,20 @@
        $cmd = join(' ', @ARGV)
 }
 
+# Evaluate target hosts.
 my @hosts = ();
-if ($hostlist) {
-       # Expand host ranges.
-       @hosts = SystemImager::HostRange::expand_range_list($hostlist);
-} elsif ($hostlist_file) {
+if ($hostlist_file) {
        # Read input file.
-       open(IN, "<$hostlist_file") ||
+       open(IN, '<', $hostlist_file) ||
                die("error: could't read $hostlist_file!\n");
-       chomp(@hosts = <IN>);
+       $hostlist .= ' ' . join(' ', <IN>);
        close(IN);
-       # Expand host ranges.
-       my %expanded_hosts = ();
-       foreach my $line (@hosts) {
-               my @list = split(/,| |\n/, $line);
-               foreach my $range (@list) {
-                       SystemImager::HostRange::expand_range(\%expanded_hosts, 
$range);
-               }
-       }
-       # Convert hosts hash into a list.
-       @hosts = sort(keys(%expanded_hosts));
-} else {
+}
+if ($hostlist) {
+       # Expand host groups and host ranges.
+       @hosts = SystemImager::HostRange::expand_groups($hostlist);
+}
+unless (@hosts) {
        die("error: no host defined!\nTry \"--help\" for more options.\n");
 }
 
@@ -115,12 +119,17 @@
        $SystemImager::HostRange::concurrents = $concurrents;
 }
 
-### END evaluate command line options ###
-
 # Use the following ssh options.
 my $ssh_opts = "-x -o BatchMode=yes -o ConnectTimeout=$timeout -l $ssh_user";
+if ($imaging) {
+       $ssh_opts .= ' -o StrictHostKeyChecking=no -o 
UserKnownHostsFile=/dev/null';
+}
 
+### END evaluate command line options ###
+
 if ($cmd) {
+       $cmd =~ s/"/\\"/g;
+       $cmd = "\"$cmd\"";
        SystemImager::HostRange::thread_pool_spawn('ssh', $ssh_opts, $cmd, 
@hosts);
 } else {
        # Run in interactive mode.
@@ -135,6 +144,8 @@
                if ((/^\s*$/) || (/^\s*exit\s*$/)) {
                        last;
                }
+               $_ =~ s/"/\\"/g;
+               $_ = "\"$_\"";
                SystemImager::HostRange::thread_pool_spawn('ssh', $ssh_opts, 
$_, @hosts);
        }
 }
@@ -172,14 +183,15 @@
 
 =item B<--hosts | -n HOST_LIST>
 
-List of target nodes.
-List can be separated by comma, spaces or new line and can include
-ranges (e.g. "node001-node256,node300 node400").
+List of target nodes. List can be separated by comma, spaces or new line and 
can
+include ranges or host groups (e.g. "node001-node256 node300,Login,Storage").
+Host groups must be defined by si_clusterconfig(8).
 
 =item B<--hosts-file | -f FILE>
 
-File that contains the list of the target hosts.
-Every line can include one or more ranges (e.g. "node001-node256,node300 
node400").
+File that contains the list of the target hosts. Every line can include one or
+more ranges or host groups (e.g. "node001-node256 node300,Login,Storage").
+Host groups must be defined in si_clusterconfig(8).
 
 =item B<--timeout | -t NUM>
 
@@ -189,9 +201,16 @@
 
 Run the command as user USER.
 
+=item B<--imaging | -i>
+
+Run the command on imaging clients (that have a ssh deamon enabled - add SSHD=y
+in the installation boot parameters and include a valid authorized_keys into
+the initrd.img). See si_mkbootpackage(8) or si_prepareclient(8) for more
+details.
+
 =head1 SEE ALSO
 
-systemimager(8), perldoc si_pcp, perldoc si_pushinstall
+systemimager(8), si_pcp(8), si_pushinstall(8), si_clusterconfig(8) 
 
 =head1 AUTHOR

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sisuite-users mailing list
sisuite-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to