This file is indexed.

/etc/maas/templates/power/sm15k.template is in maas-cluster-controller 1.5+bzr2252-0ubuntu1.

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
# -*- mode: shell-script -*-
#
# Control a system via ipmipower, sending the seamicro specific hex codes
#

# Parameters
power_change={{power_change}}
power_address={{power_address}}
power_user={{power_user}}
power_pass={{power_pass}}
power_control={{power_control}}
system_id={{system_id}}
ipmitool={{ipmitool}}

# IPMI power mode
{{py: power_mode = 1 if power_change == 'on' else 6 }}
power_mode={{power_mode}}

# Control power using IPMI
issue_ipmi_command() {
    ${ipmitool} -I lanplus \
        -H ${power_address} -U ${power_user}\
        -P ${power_pass} raw 0x2E 1 0x00 0x7d 0xab \
        ${power_mode} 0 ${system_id}
}

# Control power using REST v0.9
issue_rest_v09_command() {
python - << END
from provisioningserver.custom_hardware.seamicro import power_control_seamicro15k_v09
power_control_seamicro15k_v09("${power_address}", "${power_user}", "${power_pass}", "${system_id}", "${power_change}")
END
}

# Control power using REST v2
issue_rest_v2_command() {
python - << END
from provisioningserver.custom_hardware.seamicro import power_control_seamicro15k_v2
power_control_seamicro15k_v2("${power_address}", "${power_user}", "${power_pass}", "${system_id}", "${power_change}")
END
}

if [ "${power_control}" = "ipmi" ]
then
    issue_ipmi_command
elif [ "${power_control}" = "restapi" ]
then
    issue_rest_v09_command
elif [ "${power_control}" = "restapi2" ]
then
    issue_rest_v2_command
fi