zhaojinhong / pdsh-ops_tools

Automatically exported from code.google.com/p/pdsh
GNU General Public License v2.0
0 stars 0 forks source link

Add option for specifying a domain #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In my use of pdsh I had to explictly create lists of the form:

AZ-1.DOMAINNAME.COM
AZ-2.DOMAINNAME.COM

in order to use pdsh or I had to use

pdsh -l user -w az1.domainname.com,az-2.domainname.com command

Both forms seem clumsy when a form like:

pdsh -H domainname.com -l user -w az1,az-2 command

would be so much cleaner and faster.

Original issue reported on code.google.com by polymi...@gmail.com on 25 May 2011 at 11:38

GoogleCodeExporter commented 9 years ago
what version of pdsh are you using? A host suffix works in recent versions:

grondo@atlas1 ~ >pdsh -qw az-[1,2].llnl.gov | tail -1
az-1.llnl.gov,az-2.llnl.gov

I'm assuming that does what you need?

NB: By default pdsh will strip the domain name in the output.
There is an undocumented option -K that will keep the domain
name, if, for example, you have sets of hosts from different
domains.

Original comment by mark.gro...@gmail.com on 26 May 2011 at 4:53

GoogleCodeExporter commented 9 years ago
The current method you describe works fine for a couple of hosts, but for the 
case where I want to do many disparate cases, having to include the domain in 
each case is clumsy. E.G.

pdsh -w az[1,4].domain.com,dc[3,6,8].domain.com,la-[1-10,13,115].domian.com -- 
command

VS

pdsh -H domain.com -w az[1,4],dc[3,6,8],la[1-10,13,115] -- command

Much cleaner and quicker to enter IMHO, also I would extend the concept for 
differnt domains like so:

pdsh -w 
az[1,3]domain.com,dc[1-10].domain.com,dcx[1,4].different.com,dal[1,3,5].differen
t.com -- command

could be

pdsh -H domain.com -w az[1,3],dc[1-10] -H different -w dcx[1,4],dal[1,3,5] -- 
command

Each -H would modify the succeeding -w list.

Original comment by polymi...@gmail.com on 26 May 2011 at 11:37

GoogleCodeExporter commented 9 years ago
I was thinking about this request and I think that a more generic solution, if 
acceptable to you, might be more palatable. What if there was a way, either 
within
-w or with a new option like -H, to add generic prefix or suffix to all 
subsuquent hosts. 

For your case you would be able to do

 pdsh -H .domain.com -w hosts... -H .other.com -w hosts,... 

but this would also be useful to target all hosts with a common suffix, e.g.

 pdsh -H -eth2 -w a,b

would target a-eth2, b-eth2

Original comment by mark.gro...@gmail.com on 4 Jun 2011 at 8:17

GoogleCodeExporter commented 9 years ago
:) I thought that was what I said :)

Original comment by polymi...@gmail.com on 4 Jun 2011 at 8:22

GoogleCodeExporter commented 9 years ago
oh, ok. The only difference is that you will have to provide the leading dot 
when specifying the domain when working with an arbitrary suffix instead of a 
"host domain" specific option. e.g.:

 -H .domain.com

vs

 -H domain.com

I'm also going experiment with a syntax to add this functionality to -w instead
of using up a new option

Original comment by mark.gro...@gmail.com on 4 Jun 2011 at 8:28

GoogleCodeExporter commented 9 years ago
Maybe something like

-w host1.domain1.com,host2,host1.domain2.com,host2

Original comment by polymi...@gmail.com on 4 Jun 2011 at 8:36