/var/lib/pcp/testsuite/common.discovery is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #
# Common shell routines for testing service discovery
# Copyright (c) 2014 Red Hat.
#
. ./common.product
. ./common.filter
. ./common.check
_filter_discovery_sought()
{
# Only pmcd is guaranteed to be running, but other services may also be.
# Transform two cases - no servers vs found servers - into deterministic
# output for the --all invocations
sed \
-e 's/No \(pmproxy servers\) discovered/Sought \1/g' \
-e 's/No \(pmwebd servers\) discovered/Sought \1/g' \
-e 's/Discovered \(pmproxy servers\):/Sought \1/g' \
-e 's/Discovered \(pmwebd servers\):/Sought \1/g' \
# end
}
_filter_discovery_unresolved()
{
tee -a $here/$seq.full \
| sed -e '/ pcp:/d;
/ proxy:/d;
/ http:/d' \
| _filter_discovery_sought
}
_filter_discovery_resolved()
{
# Pass unresolved urls, filter the resolved ones.
tee -a $here/$seq.full \
| sed -e '/ pcp:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
/ proxy:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
/ http:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
/ pcp:/d;
/ proxy:/d;
/ http:/d' \
| _filter_discovery_sought \
| _filter_discovery_unresolvable
}
_filter_discovery_unresolvable()
{
# For each unresolved address in the response, see if we can resolve
# it using dig(1). If not, filter it out as an unresolvable result.
# Oherwise, leave it in as an erroneous result.
while read line
do
# If the line is an unresolved service, then see if we can resolve it
# using dig(1).
if echo $line | grep -q -e '^pcp://' -e '^proxy://' -e '^http://';
then
addr=`echo $line |
sed -e 's|pcp://\(.*\):[0-9]\+|\1|'`
# If dig(1) can not resolve this address, then it is a correctly
# unresolved address. Filter it out. Otherwise keep it as an
# erroneously unresolved address.
dug=`dig -x $addr +short`
[ -z "$dug" ] && continue
fi
# Keep this line
echo $line
done
}
_control_service_discovery()
{
# Stop any peripheral long-running PCP services (anything not pmcd)
# that might be advertising on the network, potentially interfering
# with a test. List of services here should match PM_SERVER_*_SPEC
# from <pcp/pmapi.h> (all except PM_SERVER_SERVICE_SPEC)
$sudo $PCP_BINADM_DIR/pmsignal -a pmproxy pmwebd
}
|