diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-09-06 12:22:52 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-09-06 12:22:52 +0300 |
commit | 3e254c16183a19cb7c45114a099efc34f189cebc (patch) | |
tree | 229a6662add77d11744367d0dd1c896f670dbcbb | |
parent | 14504db91c95949df7973f97aba7ab0a6a35c520 (diff) | |
download | rex-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-x | rex.exp | 15 | ||||
-rw-r--r-- | rex.man8 | 7 |
2 files changed, 9 insertions, 13 deletions
@@ -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} { @@ -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 |