File: zone_util.rb

package info (click to toggle)
puppet-agent 8.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,392 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (28 lines) | stat: -rw-r--r-- 842 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
#
module ZoneUtils
  def clean(agent)
    on(agent, 'zoneadm list -cip').stdout.lines.each do |l|
      case l
      when %r{tstzone:running}
        on agent, 'zoneadm -z tstzone halt'
        on agent, 'zoneadm -z tstzone uninstall -F'
        on agent, 'zonecfg -z tstzone delete -F'
        on agent, 'rm -f /etc/zones/tstzone.xml'
      when %r{tstzone:configured}
        on agent, 'zonecfg -z tstzone delete -F'
        on agent, 'rm -f /etc/zones/tstzone.xml'
      when %r{tstzone:*}
        on agent, 'zonecfg -z tstzone delete -F'
        on agent, 'rm -f /etc/zones/tstzone.xml'
      end
    end
    on(agent, 'zfs list').stdout.lines.each do |l|
      case l
      when %r{rpool.tstzones}
        on agent, 'zfs destroy -f -r rpool/tstzones'
      end
    end
    on agent, 'rm -rf /tstzones'
  end
  module_function :clean
end