aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-09-06 12:22:52 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-09-06 12:22:52 +0300
commit3e254c16183a19cb7c45114a099efc34f189cebc (patch)
tree229a6662add77d11744367d0dd1c896f670dbcbb
parent14504db91c95949df7973f97aba7ab0a6a35c520 (diff)
downloadrex-3e254c16183a19cb7c45114a099efc34f189cebc.tar.gz
rex-3e254c16183a19cb7c45114a099efc34f189cebc.tar.bz2
Make pmres self-contained
* rex.exp (pmres::host_order_cache): New variable (pmres::hostorder): Use host_order_cache instead of config(hostorder) * rex.man8: Update.
-rwxr-xr-xrex.exp15
-rw-r--r--rex.man87
2 files changed, 9 insertions, 13 deletions
diff --git a/rex.exp b/rex.exp
index 20a0d04..46a96df 100755
--- a/rex.exp
+++ b/rex.exp
@@ -53,23 +53,24 @@ proc config_option {key} {
# and parsing its return.
# #######################################################################
-namespace eval pmres {
+namespace eval pmres {
+ variable host_order_cache
+
proc hostorder {} {
- global config
-
- if {![info exists config(hostorder)]} {
- set config(hostorder) {files dns}
+ variable host_order_cache
+ if {![info exists host_order_cache]} {
+ set host_order_cache {files dns}
if {[catch {open "/etc/nsswitch.conf" "r"} fd] == 0} {
while {[gets $fd line] >= 0} {
if [regexp {[^[:space:]]*hosts:} "$line"] {
- set config(hostorder) [lrange [regexp -all -inline {[^[:space:]]+} $line] 1 end]
+ set host_order_cache [lrange [regexp -all -inline {[^[:space:]]+} $line] 1 end]
break
}
}
close $fd
}
}
- return $config(hostorder)
+ return $host_order_cache
}
proc files_match {mode arg var} {
diff --git a/rex.man8 b/rex.man8
index 2a158c0..f26038f 100644
--- a/rex.man8
+++ b/rex.man8
@@ -13,7 +13,7 @@
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with Rex. If not, see <http://www.gnu.org/licenses/>.
-.TH REX 8 "September 4, 2016" "REX" "Rex User Reference"
+.TH REX 8 "September 6, 2016" "REX" "Rex User Reference"
.ds ET /etc
.SH NAME
rex \- remote execution utility
@@ -591,11 +591,6 @@ List of host names to exclude from processing. Normally set via the
(string) Name of the file to read instead of the default configuration
files.
.TP
-.B hostorder
-(string) Order of host lookup. By default obtained from the
-\fB\*(ET/nsswitch.conf\fR file, \fBhosts\fR statement (
-.BR nsswitch.conf (5)).
-.TP
.B hosts
List of hosts to run command on.
.TP

Return to:

Send suggestions and report system problems to the System administrator.