File: 915

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (151 lines) | stat: -rwxr-xr-x 4,593 bytes parent folder | download
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
# PCP QA Test No. 915
# Test local daemon access override settings in PCP_SYSCONFIG_DIR
#
# Copyright (c) 2015 Red Hat.
#

seq=`basename $0`
echo "QA output created by $seq"

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

[ "$PCPQA_SYSTEMD" = yes ] || _notrun "systemctl not installed or not active"

case `admin/whatami`
in
    *Ubuntu\ 16.04\ *)
	_notrun "cannot make loop pmproxy access work for Ubuntu 16.04"
	;;
esac

host=`hostname`
[ -z "$host" ] && _notrun "Cannot discover local host name"
interface=`_host_to_ipaddr $host`
[ -z "$interface" ] && _notrun "Cannot translate hostname ($host) to interface"
[ "$interface" = "127.0.0.1" ] && _notrun "$host => localhost"

status=1	# failure is the default!

echo "interface=$interface" >>$seq_full
pmproxy_was_running=false
[ -f $PCP_RUN_DIR/pmproxy.pid ] && pmproxy_was_running=true
echo "pmproxy_was_running=$pmproxy_was_running" >>$seq_full

_cleanup()
{
    # ensure we do not leave local-only settings enabled
    _restore_config $PCP_SYSCONFIG_DIR/pmcd
    _restore_config $PCP_SYSCONFIG_DIR/pmproxy
    _restore_config $PCP_SYSCONF_DIR/pmproxy/pmproxy.conf
    _restore_config $PCP_SYSCONFIG_DIR/pmlogger
    _restore_config $PCP_PMPROXYOPTIONS_PATH

    if $pmproxy_was_running
    then
	echo "Restart pmproxy ..." >>$seq_full
	_service pmproxy restart >>$seq_full 2>&1
	_wait_for_pmproxy
    else
	echo "Stopping pmproxy ..." >>$seq_full
	_service pmproxy stop >>$seq_full 2>&1
    fi
    _restore_auto_restart pmproxy
    _service pmcd restart 2>&1 | _filter_pcp_restart
    _wait_for_pmcd
    _restore_auto_restart pmcd
    _service pmlogger restart 2>&1 | _filter_pcp_restart
    _wait_for_pmlogger

    rm -rf $tmp.*
}

_filter()
{
    tee -a $seq_full | \
    sed \
	-e "s/$host/HOSTNAME/g" \
	-e "s/$interface/INTERFACE/g" \
    #end
}
trap "_cleanup; exit \$status" 0 1 2 3 15

# real QA test starts here
_save_config $PCP_SYSCONFIG_DIR/pmcd
_save_config $PCP_SYSCONFIG_DIR/pmproxy
_save_config $PCP_SYSCONF_DIR/pmproxy/pmproxy.conf
_save_config $PCP_SYSCONFIG_DIR/pmlogger
_save_config $PCP_PMPROXYOPTIONS_PATH

_stop_auto_restart pmproxy
if ! _service pmproxy stop >>$seq_full 2>&1; then _exit 1; fi

echo "# Installed by PCP QA test $seq on `date`" > $tmp.local
echo PMCD_LOCAL=1 >> $tmp.local
$sudo cp $tmp.local $PCP_SYSCONFIG_DIR/pmcd

echo "# Installed by PCP QA test $seq on `date`" > $tmp.local
echo PMPROXY_LOCAL=1 >> $tmp.local
$sudo cp $tmp.local $PCP_SYSCONFIG_DIR/pmproxy

cat >$tmp.local << End-Of-File
# Installed by PCP QA test $seq on `date`
# ... aiming for a minimal and fast startup
[pmproxy]
pcp.enabled = true
[discover]
enabled = false
[pmseries]
enabled = false
End-Of-File
$sudo cp $tmp.local $PCP_SYSCONF_DIR/pmproxy/pmproxy.conf

echo "# Installed by PCP QA test $seq on `date`" > $tmp.local
echo PMLOGGER_LOCAL=1 >> $tmp.local
$sudo cp $tmp.local $PCP_SYSCONFIG_DIR/pmlogger

echo "# Installed by PCP QA test $seq on `date`" > $tmp.local
# uncomment the next line to make the logfile names unique
#echo "-Dappl1" >> $tmp.local
# uncomment the next line to debug connections and pdus (desperate)
echo "-Dcontext,pdu" >> $tmp.local
$sudo cp $tmp.local $PCP_PMPROXYOPTIONS_PATH

if ! _service pmproxy start 2>&1; then _exit 1; fi | _filter_pmproxy_start
_wait_for_pmproxy || _exit 1
if ! _service pmcd restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmcd || _exit 1
if ! _service pmlogger restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmlogger || _exit 1

echo; echo "== checking loop pmcd access, expecting success"
pminfo -f -h localhost pmcd.feature.local 2>&1 | _filter

echo; echo "== checking bad pmcd access, expect no values"
pminfo -f -h $interface pmcd.feature.local 2>&1 | _filter

echo; echo "== checking primary pmlogger started in local-only mode"
pminfo -f -h local: pmcd.pmlogger.host 2>&1 | _filter | grep primary

echo; echo "== checking loop pmlogger access, expecting success"
echo quit | pmlc -h localhost -P 2>&1 | _filter

echo; echo "== checking bad pmlogger access, expect no control"
echo quit | pmlc -h $interface -P 2>&1 | _filter

echo; echo "== checking bad pmproxy access, expect no values" | tee -a $seq_full
pminfo -f -h localhost@$interface pmcd.feature.local 2>&1 | _filter
cat $PCP_LOG_DIR/pmproxy/pmproxy.log >> $seq_full

echo; echo "== checking loop pmproxy access, expecting success" | tee -a $seq_full
pminfo -f -h localhost@localhost pmcd.feature.local 2>&1 | _filter
cat $PCP_LOG_DIR/pmproxy/pmproxy.log >> $seq_full

# success, all done
status=0
exit