This file is indexed.

/etc/cobbler/power/power_virsh.template is in maas-provision-common 2.2.2-0ubuntu4.

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
## Set proper virsh operation
#if $power_mode == "on"
    #set operation = "start"
#else
    #set operation = "destroy"
#end if

## Build connection URI
## driver[+transport]://[username@][hostname][:port]/[path][?extraparameters]

## Determine requested driver to use (defaults to 'qemu')
#if $power_address and $power_address.count(':') > 0
    #set (driver, power_address) = $power_address.split('://', 1)
#else
    #set driver = "qemu"
#end if

## Was a username requested (defaults to '')?
#if $power_user
    #set $username = "%s@" % $power_user
#else
    #set $username = ""
#end if

## Default to localhost
#if $username and $power_address is None or $power_address == ""
    #set $power_address = "localhost"
#end if

## Perform requested action
## NOTE - may require additional setup by sys-admin to enable passwd-less operation
domstate=\$(/usr/bin/virsh --connect $driver://$username$power_address/system domstate $power_id)
if [ "$operation" = "destroy" -a "$domstate" = "running" -o "$operation" = "start" -a "$domstate" = "shut off" ]; then
    /usr/bin/virsh --connect $driver://$username$power_address/system $operation $power_id
fi