This file is indexed.

/usr/share/pyshared/provisioningserver/power/templates/fence_cdu.template is in python-maas-provisioningserver 1.2+bzr1373+dfsg-0ubuntu1~12.04.6.

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
# -*- mode: shell-script -*-
#
# Control virtual system's "power" through virsh.
#

# Parameters.
# Choose command for virsh to make the requested power change happen.
power_change={{power_change}}
power_address={{power_address}}
power_user={{power_user}}
power_pass={{power_pass}}
power_id={{power_id}}
fence_cdu={{fence_cdu}}


formulate_power_command() {
  if [ ${power_change} = 'on' ]
  then
      echo 'on'
  else
      echo 'off'
  fi
}


# Express system's current state as expressed by virsh as "on" or "off".
formulate_power_state() {
    case $2 in
    'on'|'ON') echo 'on' ;;
    'off'|'OFF') echo 'off' ;;
    *)
        echo "Got unknown power state from fence_cdu: '$1'" >&2
        exit 1
    esac
}


# Issue command to virsh, for the given system.
issue_fence_cdu_command() {
    ${fence_cdu} -a ${power_address} -n ${power_id} -l ${power_user} -p ${power_pass} -o "$@"
}


# Get the given system's power state: 'on' or 'off'.
get_power_state() {
    fence_cdu_state=$(issue_fence_cdu_command status)
    formulate_power_state ${fence_cdu_state}
}


if [ "$(get_power_state)" != "${power_change}" ]
then
    issue_fence_cdu_command $(formulate_power_command)
fi