This file is indexed.

/var/lib/pcp/testsuite/common.webapi 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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#
# Common shell routines for testing the REST API daemon
# Copyright (c) 2014,2018 Red Hat.
#

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

unset http_proxy
unset HTTP_PROXY

_check_pmwebd()
{
    [ -f ${PCP_BINADM_DIR}/pmwebd ] || _notrun "pmwebd package not installed"
    $python -c "import requests" >/dev/null 2>&1 || _notrun "$python requests package is not installed"
}

_check_requests_json()
{
    version=`$python --version 2>&1 | sed -e 's/Python //'`
    case "$version"
    in
	2.7.3|2.7.4)
	    _notrun "requests.json() broken in Python $version"
	    ;;
    esac
}

_webapi_header_filter()
{
    tee -a $here/$seq.full \
    | col -b \
    | sed \
	-e 's/^\(Content-Length:\) [0-9][0-9]*/\1 SIZE/g' \
	-e 's/^\(Date:\).*/\1 DATE/g' \
	-e 's/\(\"context\":\) [0-9][0-9]*/\1 CTXID/g' \
	-e '/^Connection: Keep-Alive/d' \
    | LC_COLLATE=POSIX sort
}

_webapi_response_filter()
{
    tee -a $here/$seq.full \
    | col -b \
    | sed -e 's,#[0-9]*,####,g' \
        -e 's/ connected$//g' \
        -e '/^\* Adding handle: /d' \
        -e '/^\* Closing connection ####/d' \
        -e '/- Conn .*_pipe.*_pipe/d' \
        -e '/Curl_[\.a-zA-Z0-9]*:/d' \
        -e 's/::1/LOCALADDR/g' \
        -e 's/127\.0\.0\.1/LOCALADDR/g' \
        -e 's/PMWEBD error, .*/PMWEBD error, XXX/g' \
        -e 's/localhost[\.a-zA-Z0-9]*/LOCALHOST/g' \
        -e 's/Date:.*/Date: DATE/' \
	-e 's/\[[0-9][0-9]* bytes data]/[data not shown]/' \
        -e '/> User-Agent: /d' \
	-e '/Connection: Keep-Alive/d' \
    # end
}

# wait_for_pmwebd port [logfile]
#
_wait_for_pmwebd()
{
    webport=$1

    if [ -z "$webport" ]
    then
	echo "Must specify a web port (system default 44323)"
	status=1
	exit
    fi

    count=0
    while ! $PCP_BINADM_DIR/telnet-probe -c localhost $webport
    do
	count=`expr $count + 1`
	if [ $count -ge 20 ]
	then
	    echo "pmwebd failed to start on port $webport"
	    echo "likely looking processes ..."
	    $PCP_PS_PROG $PCP_PS_ALL_FLAGS | egrep '[P]ID|[p]mwebd'
	    if [ -n "$2" ]
	    then
		if [ -f "$2" ]
		then
		    echo "pmwbed logfile ($2) ..."
		    cat "$2"
		else
		    echo "pmwbed logfile ($2) not created"
		fi
	    fi
	    status=1
	    exit
	fi
	pmsleep 0.1
    done
}

_wait_for_pmwebd_logfile()
{
    logfile="$1"
    webport="$2"

    if [ -z "$logfile" ]
    then
	echo "Must specify log (system default $PCP_LOG_DIR/pmwebd/pmwebd.log)"
	status=1
	exit
    fi

    # let it start up
    _wait_for_pmwebd $webport

    count=0
    while [ ! -f "$logfile" ]
    do
	count=`expr $count + 1`
	if [ $count -ge 20 ]
	then
	    date
	    echo "pmwebd failed to start, $logfile not created"
	    echo "likely looking processes ..."
	    $PCP_PS_PROG $PCP_PS_ALL_FLAGS | egrep '[P]ID|[p]mwebd'
	    status=1
	    exit
	fi
	pmsleep 0.1
    done
    date >>$here/$seq.full
    cat "$logfile" >>$here/$seq.full
}