Given an array of hostnames, how can I generate a set of files based on those hostnames in puppet - puppet

I am not sure there is a way to even do this in puppet, but here is what I am trying to do.
Given this skeletal puppet class definition ...
class make_files (
$rabbit_servers = ['rabbit-1','rabbit-2'],
$mongo_servers = ['mongo-1','mongo-2'],
) {
...
}
... generate the files ...
# pwd
/root/conf/hosts
# more rabbit-*
::::::::::::::
rabbit-1.cfg
::::::::::::::
define host {
use linux-server
host_name rabbit-1
alias Rabbit MQ host
hostgroups rabbit_hosts
address 10.29.103.33
}
::::::::::::::
rabbit-2.cfg
::::::::::::::
define host {
use linux-server
host_name rabbit-2
alias Rabbit MQ host
hostgroups rabbit_hosts
address 10.29.103.34
}
# more mongo-*
::::::::::::::
mongo-1.cfg
::::::::::::::
define host {
use linux-server
host_name mongo-1
alias Mongo DB host
hostgroups mongo_hosts
address 10.29.103.31
}
::::::::::::::
mongo-2.cfg
::::::::::::::
define host {
use linux-server
host_name mongo-2
alias Mongo DB host
hostgroups mongo_hosts
address 10.29.103.32
}
Where the IP addresses are the IP address of the corresponding host.
Any help is much appreciated.

If the names belong to nodes that are managed by Puppet, you can fetch the addresses from PuppetDB directly using the puppetdbquery module
$ipaddress = query_facts("hostname=$host_name", ['ipaddress'])['ipaddress']
The code is untested, I'm not sure whether the invocation is correct.

I have found a solution ...
class make_files (
$rabbit_servers = ['rabbit-1:10.29.103.33','rabbit-2:10.29.103.34'],
$mongo_servers = ['ost-mongo-el7-001:10.29.103.31'],
) {
define my_file ($content, $hostgroup) {
$tuple = split($name, ':')
$host_name = $tuple[0]
$file_name = "/tmp/$host_name.cfg"
$ipaddress = $tuple[1]
$config = "define host {
use linux-server
host_name $host_name
alias $host_name
hostgroups $hostgroup
address $ipaddress
}"
file { $file_name:
ensure => file,
content => $config,
}
}
$rabbit_content = join($rabbit_servers, ',')
my_file { $rabbit_servers: content => $rabbit_content, hostgroup => 'rabbit_hosts' }
$mongo_content = join($mongo_servers, ',')
my_file { $mongo_servers: content => $mongo_content, hostgroup => 'mongo_hosts' }
}
... and I found that I needed to change the content of the files slightly.
This is probably not the best answer but it seems to work. I am open to suggested improvements.
Thanks

Related

If "keyword" in message not working for logstash

I am receiving logs from 5 different sources on one single port. In fact it is a collection of files being sent through syslog from a server in realtime. The server stores logs from 4 VPN servers and one DNS server. Now the server admin started sending all 5 types of files on a single port although I asked something different. Anyways, I thought to make this also work now.
Below are the different types of samples-
------------------
<13>Sep 30 22:03:28 xx2.20.43.100 370 <134>1 2021-09-30T22:03:28+05:30 canopus.domain1.com1 PulseSecure: - - - id=firewall time="2021-09-30 22:03:28" pri=6 fw=xx2.20.43.100 vpn=ive user=System realm="google_auth" roles="" proto= src=1xx.99.110.19 dst= dstname= type=vpn op= arg="" result= sent= rcvd= agent="" duration= msg="AUT23278: User Limit realm restrictions successfully passed for /google_auth "
------------------
<134>Sep 30 22:41:43 xx2.20.43.101 1 2021-09-30T22:41:43+05:30 canopus.domain1.com2 PulseSecure: - - - id=firewall time="2021-09-30 22:41:43" pri=6 fw=xx2.20.43.101 vpn=ive user=user22 realm="google_auth" roles="Domain_check_role" proto= src=1xx.200.27.62 dst= dstname= type=vpn op= arg="" result= sent= rcvd= agent="" duration= msg="NWC24328: Transport mode switched over to SSL for user with NCIP xx2.20.210.252 "
------------------
<134>Sep 30 22:36:59 vpn-dns-1 named[130237]: 30-Sep-2021 22:36:59.172 queries: info: client #0x7f8e0f5cab50 xx2.30.16.147#63335 (ind.event.freefiremobile.com): query: ind.event.freefiremobile.com IN A + (xx2.31.0.171)
------------------
<13>Sep 30 22:40:31 xx2.20.43.101 394 <134>1 2021-09-30T22:40:31+05:30 canopus.domain1.com2 PulseSecure: - - - id=firewall time="2021-09-30 22:40:31" pri=6 fw=xx2.20.43.101 vpn=ive user=user3 realm="google_auth" roles="Domain_check_role" proto= src=1xx.168.77.166 dst= dstname= type=vpn op= arg="" result= sent= rcvd= agent="" duration= msg="NWC23508: Key Exchange number 1 occurred for user with NCIP xx2.20.214.109 "
Below is my config file-
syslog {
port => 1301
ecs_compatibility => disabled
tags => ["vpn"]
}
}
I tried to apply a condition first to get VPN logs (1st sample logline) and pass it to dissect-
filter {
if "vpn" in [tags] {
#if ([message] =~ /vpn=ive/) {
if "vpn=ive" in [message] {
dissect {
mapping => { "message" => "%{reserved} id=firewall %{message1}" }
# using id=firewall to get KV pairs in message1
}
}
}
else { drop {} }
# \/ end of filter brace
}
But when I run with this config file, I am getting mixture of all 5 types of logs in kibana. I don't see any dissect failures as well. I remember this worked in some other server for other type of log, but not working here.
Another question is, if I have to process all 5 types of logs in one config file, will below be a good approach?
if "VPN-logline" in [message] { use KV plugin and add tag of "vpn" }
else if "DNS-logline" in [message] { use JSON plugin and tag of "dns"}
else if "something-irrelevant" in [message] { drop {} }
Or can it be done in input section of config?
So, the problem was to assign every logline with the tag pf vpn. I was doing so because I had to merge this config to a larger config file that carries many more tags.Anyways, now thought to keep this config file separate only.
input {
syslog {
port => 1301
ecs_compatibility => disabled
}
}
filter {
if "vpn=ive" in [message] {
dissect {
mapping => { "message" => "%{reserved} id=firewall %{message1}" }
}
}
else { drop {} }
}
output {
elasticsearch {
hosts => "localhost"
index => "vpn1oct"
user => "elastic"
password => "xxxxxxxxxx"
}
stdout { }
}

How to insert lines after second pattern with linux sed command

I want to insert this block:
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
after this block:
subnet 11.10.0.0 netmask 255.255.255.0 {
range 11.10.1.2 11.10.1.254;
group {
filename "10M-5M-OKS2016NOV.cm";
The line: filename "10M-5M-OKS2016NOV.cm";
apears multiple times in the file. But only once inside subnet 11.10.0.0 netmask 255.255.255.0 {
Until now I can print the subnet block until the "filename":
sed -n -e :a -e '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/,/}/{/filename "10M-5M-OKS2016NOV\.cm";/!{$!{N;ba};};p;}' dhcpd.conf
but when I try:
sed -n -e :a -e '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/,/}/{/filename "10M-5M-OKS2016NOV\.cm";/!{$!{N;ba};};a\ \thost client3 {\n\thardware ethernet c0:03:03:bc:30:fa;\n\t}\n;}' dhcpd.conf
I get:
sed: -e expression #1, char 0: unmatched `{'
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet a0:b4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ba:cd:d4;
}
}
}
subnet 11.10.0.0 netmask 255.255.255.0 {
range 11.10.1.2 11.10.1.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet c0:14:e3:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:fb:ba:3d:04;
}
}
}
subnet 12.10.0.0 netmask 255.255.255.0 {
range 12.10.2.2 12.10.2.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet c0:a4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ca:3d:04;
}
}
}
Please try something like:
#!/bin/bash
# define newline and tab characters for replacement
NL=$'\n'
NL="\\$NL"
TAB=$'\t'
TAB="\\$TAB"
sed '
:l
N
$!b l
# first of all slurp all lines in the pattern space
# and perform the replacement over the lines
s/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0[^}]*filename "10M-5M-OKS2016NOV\.cm";/&'"$NL$TAB"'host client3 {'"$NL$TAB$TAB"'hardware ethernet c0:03:03:bc:30:fa;'"$NL$TAB"'}/g
' dhcpd.conf
It yields the following output by using the posted lines as dhcpd.conf,
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet a0:b4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ba:cd:d4;
}
}
}
subnet 11.10.0.0 netmask 255.255.255.0 {
range 11.10.1.2 11.10.1.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
host client1 {
hardware ethernet c0:14:e3:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:fb:ba:3d:04;
}
}
}
subnet 12.10.0.0 netmask 255.255.255.0 {
range 12.10.2.2 12.10.2.254;
group {
filename "10M-5M-OKS2016NOV.cm";
host client1 {
hardware ethernet c0:a4:3d:bc:df:fa;
}
host client2 {
hardware ethernet 90:6e:bb:ca:3d:04;
}
}
}
It initially slurps all the lines at first to process multi lines efficiently.
It assumes the right curly brace } does not appear in the search target block
to achieve the shortest match in regex.
Hope this helps.
This might work for you (GNU sed):
sed '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/{:a;n;/filename "10M-5M-OKS2016NOV\.cm";/!ba;p;s/\S.*/host client3 {/p;s// hardware ethernet c0:03:03:bc:30:fa;/p;s//}/}' file
This finds the first line containing subnet 11.10.0.0 netmask 255.255.255.0 and then reads on further until the line containing filename "10M-5M-OKS2016NOV.cm";. After printing that line it uses the line as a template to format the required detail.
Another solution, using a preformed insertion file:
cat <<\! | sed '/subnet 11\.10\.0\.0 netmask 255\.255\.255\.0/!b;:a;n;/filename "10M-5M-OKS2016NOV\.cm";/!ba;r /dev/stdin' file
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
!
sed is great as a stream editor, that means to process multiple times the same actions. Here you just want to insert once a bloc of text. That would be much simpler (more readable and maintenable) with ed:
ed dhcpd.conf <<EOF
/subnet 11.10.0.0/
/filename/
a
host client3 {
hardware ethernet c0:03:03:bc:30:fa;
}
.
w
q
EOF
Beware: ed is a file editor. That means that the dhcpd.conf file will be changed by the above script. Make sure to have a backup if things goes wrong...

BIND9, nsupdate and damn DDNS

I've scoured through so many HOWTO pages on DDNS to try and fix this... I'm at a loss.
WorkstationX = CentOS 6.2 x64
ServerX = Ubuntu 12.04 LTS x64
I don't understand why it's not working... I'm literally out of ideas. I have regenerated and reconfigured everything several times.
I've made sure:
Running NTPD on both hosts, I have verified NTP is working
TZ is correct for both nodes (Hardware is UTC)
I've followed these guides:
http://linux.yyz.us/nsupdate/
http://agiletesting.blogspot.com.au/2012/03/dynamic-dns-updates-with-nsupdate-and.html
http://www.cheshirekow.com/wordpress/?p=457
https://www.erianna.com/nsupdate-dynamic-dns-updates-with-bind9
http://consultancy.edvoncken.net/index.php/HOWTO_Manage_Dynamic_DNS_with_nsupdate
http://blog.philippklaus.de/2013/01/updating-dns-entries-with-nsupdate-or-alternative-implementations-your-own-ddns/
Some of them have varying ways of generating the key, but the rest is the same... and still, when I try nsupdate - even on the server where dnssec-keygen was run (and where bind is), I get the same log entries:
Aug 14 11:20:38 vps named[31247]: 14-Aug-2013 11:20:38.032 security: error: client 127.0.0.1#29403: view public: request has invalid signature: TSIG domain2.com.au.: tsig verify failure (BADKEY)
from this nsupdate:
nsupdate -k Kdomain2.com.au.+157+35454.key
server localhost
zone domain2.com.au.
update add test.domain2.com.au. 86400 IN A 10.20.30.40
show
send
What I gather is the CORRECT generated method:
dnssec-keygen -a HMAC-MD5 -b 512 -n HOST domain2.com.au.
named.conf (IPs have been changed for privacy):
acl ipv4 { 0.0.0.0/0; };
acl ipv6 { 2000::/3; ::1; fe80::/10; fec0::/10; };
acl safehosts { 127.0.0.0/8; 3.2.2.40; 44.44.14.12; };
include "/etc/bind/rndc.key";
controls {
inet * port 953
allow { safehosts; } keys { "rndc-key"; };
};
options
{
auth-nxdomain yes;
empty-zones-enable no;
zone-statistics yes;
dnssec-enable yes;
listen-on { any; };
listen-on-v6 { any; };
directory "/etc/bind/db";
managed-keys-directory "/etc/bind/keys";
memstatistics-file "/etc/bind/data/bind.memstats";
statistics-file "/etc/bind/data/bind.qstats";
};
logging
{
## CUT ##
};
view "public"
{
recursion yes;
allow-query-cache { safehosts; };
allow-recursion { safehosts; };
zone "." IN {
type hint;
file "root.zone";
};
zone "0.0.127.in-addr.arpa" {
type master;
allow-update { none; };
allow-transfer { none; };
file "0.0.127.in-addr.arpa.zone";
};
zone "localhost" {
type master;
allow-update { none; };
allow-transfer { none; };
file "localhost.zone";
};
zone "3.2.2.in-addr.arpa" {
type master;
allow-update { none; };
allow-transfer { none; };
file "3.2.2.in-addr.arpa.zone";
};
zone "domain1.com.au" {
type master;
notify yes;
allow-update { key "rndc-key"; };
allow-transfer { key "rndc-key"; };
file "domain1.com.au.zone";
};
zone "domain2.com.au" {
type master;
notify yes;
allow-update { key "rndc-key"; };
allow-transfer { key "rndc-key"; };
file "doomain2.com.au.zone";
};
};
/etc/bind/rndc.key:
key "rndc-key" {
algorithm hmac-md5;
secret "vZwCYBx4OAOsBrbdlooUfBaQx+kwEi2eLDXdr+JMs4ykrwXKQTtDSg/jp7eHnw39IehVLMtuVECTqfOwhXBm0A==";
};
Kdomain1.com.au.+157+35454.private
Private-key-format: v1.3
Algorithm: 157 (HMAC_MD5)
Key: vZwCYBx4OAOsBrbdlooUfBaQx+kwEi2eLDXdr+JMs4ykrwXKQTtDSg/jp7eHnw39IehVLMtuVECTqfOwhXBm0A==
Bits: AAA=
Created: 20130814144733
Publish: 20130814144733
Activate: 20130814144733
SOLUTION:
I have no idea why, but it is now working. The only things I did is the following:
# chown -R named:named /var/named
# find . -type d -exec chmod 770 {} \;
# find . -type f -exec chmod 660 {} \;

Perl for SNMP V3 Not Working, but works with SNMP V1/2 (Redhat Linux)

I have a Perl Script, which registers SNMP OIDs. With SNMP 1/2c, it is able to successfully register all OIDs. However, with SNMP V3, it only partially works.
As you see below, with SNMP V3, it is able to register "$root_OID.0.0.0" successfully. However, it timeouts when trying to invoke the java code for "$root_OID.0.0.1".
Does anyone know, why I'm able to make a successful java call in SNMP V1/2c, but not SNMP V3?
Many Thanks
Here is my Perl script:
#!/usr/bin/perl
use NetSNMP::OID (':all');
use NetSNMP::ASN qw(ASN_OCTET_STR ASN_INTEGER);
use NetSNMP::agent (':all');
sub myhandler {
my ($handler, $registration_info, $request_info, $requests) = #_;
my $request;
my $root_OID = ".1.3.6.1.4.1.8072.9999.9999.0";
my $CLASSPATH = "/opt/BPL/JBoss/BPL_JBossJMX.jar:/opt/jboss-5.1/client/*";
my $CLASSNAME = "com.XXXXX.XXXXX.XXXXX.jmx.BPLJbossJMX_For_SNMP";
my $ENV = "localhost";
my $PORT = "8099";
my $LOG4JFILELOC = "/opt/BPL/JBoss/JBoss-BPL-Log4j.xml";
for($request = $requests; $request; $request = $request->next()) {
my $oid = $request->getOID();
if ($request_info->getMode() == MODE_GETNEXT) {
if ($oid < new NetSNMP::OID("$root_OID.0.0.0")) {
my $INPUTSTRNAME = "HeapMemoryUsageZZZZZ";
$request->setOID("$root_OID.0.0.0");
$request->setValue(ASN_OCTET_STR, $INPUTSTRNAME);
} elsif ($oid < new NetSNMP::OID("$root_OID.0.0.1")) {
my $INPUTSTRNAME = "HeapMemoryUsage";
my $OUTPUT= `java -cp $CLASSPATH $CLASSNAME $ENV $PORT $INPUTSTRNAME $LOG4JFILELOC`;
chomp($OUTPUT);
$request->setOID("$root_OID.0.0.1");
$request->setValue(ASN_INTEGER, $OUTPUT);
}
}
}
}
my $rootOID = ".1.3.6.1.4.1.8072.9999.9999.0";
my $regoid = new NetSNMP::OID($rootOID);
$agent->register("BPL-JBoss", $regoid, \&myhandler);
Here is my /etc/snmp/snmpd.conf file (SNMP V1/2c disabled):
###############################################################################
# snmpd.conf:
###############################################################################
#com2sec notConfigUser default public
# groupName securityModel securityName
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
view systemview included .1.3.6.1.4.1.8072.1.3.2
view systemview included .1.3.6.1.2.1
view systemview included .1.3.6.1.2.1.25.1.1
view systemview included .1.3.6.1.4.1.2021
view systemview included .1.3.6.1.4.1.8072.9999.9999
#access notConfigGroup "" any noauth exact systemview none none
###############################################################################
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root#localhost> (configure /etc/snmp/snmp.local.conf)
###############################################################################
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
###############################################################################
perl do "/home/XXXXXXX/JBoss_hello_world.pl"
rouser TEST_USERNAME priv
Here is the results of my SNMPWALK, when using SNMPV3.
-$snmpwalk -v 3 -l authPriv -a sha -A TEST_PASSWORD -x AES -X TEST_PASSWORD -u TEST_USERNAME localhost .1.3.6.1.4.1.8072.9999.9999
NET-SNMP-MIB::netSnmpPlaypen.0.0.0.0 = STRING: "HeapMemoryUsageZZZZZ"
Timeout: No Response from localhost

using external redis server for testing tcl scripts

I am running Ubuntu 11.10.
i am trying to run TCL test scripts using external redis server.
using the following :
sb#sb-laptop:~/Redis/redis$ tclsh tests/test_helper.tcl --host 192.168.1.130 --port 6379
Getting the following error :
Testing unit/type/list
[exception]: Executing test client: couldn't open socket: connection refused.
couldn't open socket: connection refused
while executing
"socket $server $port"
(procedure "redis" line 2)
invoked from within
"redis $::host $::port"
(procedure "start_server" line 9)
invoked from within
"start_server {tags {"protocol"}} {
test "Handle an empty query" {
reconnect
r write "\r\n"
r flush
assert_equal "P..."
(file "tests/unit/protocol.tcl" line 1)
invoked from within
"source $path"
(procedure "execute_tests" line 4)
invoked from within
"execute_tests $data"
(procedure "test_client_main" line 9)
invoked from within
"test_client_main $::test_server_port "
the redis.conf is set to default binding, but it is commented out.
If this is possible, what i am doing wrong?
Additional Information:
Below is the tcl code that is responsible for starting the server
proc start_server {options {code undefined}} {
# If we are runnign against an external server, we just push the
# host/port pair in the stack the first time
if {$::external} {
if {[llength $::servers] == 0} {
set srv {}
dict set srv "host" $::host
dict set srv "port" $::port
set client [redis $::host $::port]
dict set srv "client" $client
$client select 9
# append the server to the stack
lappend ::servers $srv
}
uplevel 1 $code
return
}
# setup defaults
set baseconfig "default.conf"
set overrides {}
set tags {}
# parse options
foreach {option value} $options {
switch $option {
"config" {
set baseconfig $value }
"overrides" {
set overrides $value }
"tags" {
set tags $value
set ::tags [concat $::tags $value] }
default {
error "Unknown option $option" }
}
}
set data [split [exec cat "tests/assets/$baseconfig"] "\n"]
set config {}
foreach line $data {
if {[string length $line] > 0 && [string index $line 0] ne "#"} {
set elements [split $line " "]
set directive [lrange $elements 0 0]
set arguments [lrange $elements 1 end]
dict set config $directive $arguments
}
}
# use a different directory every time a server is started
dict set config dir [tmpdir server]
# start every server on a different port
set ::port [find_available_port [expr {$::port+1}]]
dict set config port $::port
# apply overrides from global space and arguments
foreach {directive arguments} [concat $::global_overrides $overrides] {
dict set config $directive $arguments
}
# write new configuration to temporary file
set config_file [tmpfile redis.conf]
set fp [open $config_file w+]
foreach directive [dict keys $config] {
puts -nonewline $fp "$directive "
puts $fp [dict get $config $directive]
}
close $fp
set stdout [format "%s/%s" [dict get $config "dir"] "stdout"]
set stderr [format "%s/%s" [dict get $config "dir"] "stderr"]
if {$::valgrind} {
exec valgrind --suppressions=src/valgrind.sup src/redis-server $config_file > $stdout 2> $stderr &
} else {
exec src/redis-server $config_file > $stdout 2> $stderr &
}
# check that the server actually started
# ugly but tries to be as fast as possible...
set retrynum 100
set serverisup 0
if {$::verbose} {
puts -nonewline "=== ($tags) Starting server ${::host}:${::port} "
}
after 10
if {$code ne "undefined"} {
while {[incr retrynum -1]} {
catch {
if {[ping_server $::host $::port]} {
set serverisup 1
}
}
if {$serverisup} break
after 50
}
} else {
set serverisup 1
}
if {$::verbose} {
puts ""
}
if {!$serverisup} {
error_and_quit $config_file [exec cat $stderr]
}
# find out the pid
while {![info exists pid]} {
regexp {\[(\d+)\]} [exec cat $stdout] _ pid
after 100
}
# setup properties to be able to initialize a client object
set host $::host
set port $::port
if {[dict exists $config bind]} { set host [dict get $config bind] }
if {[dict exists $config port]} { set port [dict get $config port] }
# setup config dict
dict set srv "config_file" $config_file
dict set srv "config" $config
dict set srv "pid" $pid
dict set srv "host" $host
dict set srv "port" $port
dict set srv "stdout" $stdout
dict set srv "stderr" $stderr
# if a block of code is supplied, we wait for the server to become
# available, create a client object and kill the server afterwards
if {$code ne "undefined"} {
set line [exec head -n1 $stdout]
if {[string match {*already in use*} $line]} {
error_and_quit $config_file $line
}
while 1 {
# check that the server actually started and is ready for connections
if {[exec cat $stdout | grep "ready to accept" | wc -l] > 0} {
break
}
after 10
}
# append the server to the stack
lappend ::servers $srv
# connect client (after server dict is put on the stack)
reconnect
# execute provided block
set num_tests $::num_tests
if {[catch { uplevel 1 $code } error]} {
set backtrace $::errorInfo
# Kill the server without checking for leaks
dict set srv "skipleaks" 1
kill_server $srv
# Print warnings from log
puts [format "\nLogged warnings (pid %d):" [dict get $srv "pid"]]
set warnings [warnings_from_file [dict get $srv "stdout"]]
if {[string length $warnings] > 0} {
puts "$warnings"
} else {
puts "(none)"
}
puts ""
error $error $backtrace
}
# Don't do the leak check when no tests were run
if {$num_tests == $::num_tests} {
dict set srv "skipleaks" 1
}
# pop the server object
set ::servers [lrange $::servers 0 end-1]
set ::tags [lrange $::tags 0 end-[llength $tags]]
kill_server $srv
} else {
set ::tags [lrange $::tags 0 end-[llength $tags]]
set _ $srv
}
}
Either there's nothing listening on host 192.168.1.130, port 6379 (well, at a guess) or your firewall configuration is blocking the connection. Impossible to say which, since all the code is really seeing is “the connection didn't work; something said ‘no’…”.

Resources