Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/pdsh.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ or "-v" would increase the verbosity of ssh. (Note: these arguments
are actually prepended to the ssh commandline to ensure they appear
before any target hostname argument to ssh.)
.TP
PDSH_DEFAULT_DOMAIN
When set, \fBpdsh\fR will append \fI.\fRDOMAIN to any short hostname
(one containing no \fI.\fR character) given to the \fI\-x\fR exclusion
option before attempting to remove it from the working collection.
This is useful when the target list (e.g. from an IPA hostgroup via
\fI\-g\fR) contains fully-qualified domain names but the exclusion list
is specified with short hostnames.
.TP
WCOLL
If no other node selection option is used, the WCOLL environment
variable may be set to a filename from which a list of target
Expand Down
20 changes: 19 additions & 1 deletion src/pdsh/opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1434,16 +1434,34 @@ static void wcoll_apply_excluded (opt_t *opt, List excludes)
{
ListIterator i;
char *arg;
const char *domain;

if (!opt->wcoll || !excludes)
return;

domain = getenv ("PDSH_DEFAULT_DOMAIN");

/*
* filter explicitly excluded hosts:
*/
i = list_iterator_create (excludes);
while ((arg = list_next (i)))
while ((arg = list_next (i))) {
hostlist_delete (opt->wcoll, arg);
/*
* If PDSH_DEFAULT_DOMAIN is set and the excluded hostname contains
* no '.' (i.e. it is a short hostname), also try to delete the
* fully-qualified form so that short hostnames in -x match FQDNs
* in the working collection (e.g. from IPA hostgroups via -g).
*/
if (domain && !strchr (arg, '.')) {
char *fqdn = NULL;
xstrcat (&fqdn, arg);
xstrcatchar (&fqdn, '.');
xstrcat (&fqdn, (char *) domain);
hostlist_delete (opt->wcoll, fqdn);
Free ((void **) &fqdn);
}
}
list_iterator_destroy (i);
}

Expand Down
Loading