HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/zoneadm.cpython-310.pyc
o

�N�g+;�@s�dZddlZddlZddlZe�e�ZdZddiZ	ej
jjdd��Z
dd	�Zd
d�Zd'dd�Zd(dd�Zd(dd�Zdd�Zd)dd�Zdd�Zd*dd�Zdd�Zdd�Zdd �Zd!d"�Zd*d#d$�Zd+d%d&�ZdS),a
Module for Solaris 10's zoneadm

:maintainer:    Jorge Schrauwen <sjorge@blackdot.be>
:maturity:      new
:platform:      OmniOS,OpenIndiana,SmartOS,OpenSolaris,Solaris 10

.. versionadded:: 2017.7.0

.. warning::
    Oracle Solaris 11's zoneadm is not supported by this module!
�N�zoneadm�
list_zones�listcCs<tddksdStdd�}|drdS|ddkrd	SdS)
z3
    Check if we are running in the globalzone
    Zkernel�SunOSF�cmd.run_all�zonename�retcode�stdout�globalT)�
__grains__�__salt__)r�r
�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/zoneadm.py�_is_globalzonesrcCst|�dko|�d�dkS)z*
    Check if zone is actually a UUID
    �$�-�)�len�index��zoner
r
r�_is_uuid-srcCsRt�r"tjj�d�r"tddvrtStddkr"ttd�dkr"tSdt�d�fS)	z�
    We are available if we are have zoneadm and are the global zone on
    Solaris 10, OmniOS, OpenIndiana, OpenSolaris, or Smartos.
    r�os)ZOpenSolarisZSmartOSZOmniOSZOpenIndianazOracle SolarisZosmajorrelease�
Fz3 module can only be loaded in a solaris globalzone.)r�salt�utils�path�whichr�__virtualname__�intr
r
r
r�__virtual__4s�r TFcCs�i}d�d�}tdd�}|ddkrZ|d��D]@}|�d�}i}t|�D]
\}	}
||	||
<q&|r:|dd	kr:q|sC|d
dkrCq|sL|d
dkrLq|||d<||dd=q|r^|St|���S)
ai
    List all zones

    verbose : boolean
        display additional zone information
    installed : boolean
        include installed zones in output
    configured : boolean
        include configured zones in output
    hide_global : boolean
        do not include global zone

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.list
    z1zoneid:zonename:state:zonepath:uuid:brand:ip-type�:rzzoneadm list -p -crrr	rr
�state�	installed�
configured)�splitr�
splitlines�	enumerate�sorted�keys)�verboser#r$Zhide_globalZzones�headerZ	zone_datarZzone_t�num�valr
r
rrGs$

cC��ddi}d}|r
d|��}|rd|�d|��}|r!d|�d|��}|dkr,d|����}td	d
jt|�r:d|��nd|��|d
��}|ddk|d<|drS|dn|d|d<|d�dd�|d<|ddkrl|d=|S)a�
    Boot (or activate) the specified zone.

    zone : string
        name or uuid of the zone
    single : boolean
        boots only to milestone svc:/milestone/single-user:default.
    altinit : string
        valid path to an alternative executable to be the primordial process.
    smf_options : string
        include two categories of options to control booting behavior of
        the service management facility: recovery options and messages options.

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.boot clementine
        salt '*' zoneadm.boot maeve single=True
        salt '*' zoneadm.boot teddy single=True smf_options=verbose
    �statusT��-s �-i � �-m � -- rzzoneadm {zone} boot{boot_opts}�-u �-z �r�	boot_optsrrr	�stderr�message�	zoneadm: ��stripr�formatr�replace�r�single�altinit�smf_options�ret�boot_options�resr
r
r�bootys,
��rHcCr.)ap
    Restart the zone. This is equivalent to a halt boot sequence.

    zone : string
        name or uuid of the zone
    single : boolean
        boots only to milestone svc:/milestone/single-user:default.
    altinit : string
        valid path to an alternative executable to be the primordial process.
    smf_options : string
        include two categories of options to control booting behavior of
        the service management facility: recovery options and messages options.

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.reboot dolores
        salt '*' zoneadm.reboot teddy single=True
    r/Tr0r1r2r3r4r5rz zoneadm {zone} reboot{boot_opts}r6r7r8rrr	r:r;r<r=rAr
r
r�reboot�s,
��rIcC�ddi}tddjt|�rd|��nd|��d��}|dd	k|d<|dr*|d
n|d|d<|d�d
d�|d<|ddkrC|d=|S)z�
    Halt the specified zone.

    zone : string
        name or uuid of the zone

    .. note::
        To cleanly shutdown the zone use the shutdown function.

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.halt hector
    r/Trzzoneadm {zone} haltr6r7rrrr	r:r;r<r0�rr?rr@�rrErGr
r
r�halt����rMcCs�ddi}d}|r
d|��}|rd|�d|��}|r!d|�d|��}|dkr,d|����}td	d
jt|�r:d|��nd|��|rBd
nd|d��}|ddk|d<|drX|dn|d|d<|d�dd�|d<|ddkrq|d=|S)a�
    Gracefully shutdown the specified zone.

    zone : string
        name or uuid of the zone
    reboot : boolean
        reboot zone after shutdown (equivalent of shutdown -i6 -g0 -y)
    single : boolean
        boots only to milestone svc:/milestone/single-user:default.
    altinit : string
        valid path to an alternative executable to be the primordial process.
    smf_options : string
        include two categories of options to control booting behavior of
        the service management facility: recovery options and messages options.

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.shutdown peter
        salt '*' zoneadm.shutdown armistice reboot=True
    r/Tr0r1r2r3r4r5rz*zoneadm {zone} shutdown{reboot}{boot_opts}r6r7z -r)rrIr9rrr	r:r;r<r=)rrIrBrCrDrErFrGr
r
r�shutdown�s.

��rOcCrJ)z�
    Detach the specified zone.

    zone : string
        name or uuid of the zone

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.detach kissy
    r/Trzzoneadm {zone} detachr6r7rrrr	r:r;r<r0rKrLr
r
r�detach4�
��rPcC�ddi}tddj||rdnd|rd|��ndd��}|d	d
k|d<|dr+|dn|d|d
<|d
�dd�|d
<|d
dkrD|d
=|S)al
    Attach the specified zone.

    zone : string
        name of the zone
    force : boolean
        force the zone into the "installed" state with no validation
    brand_opts : string
        brand specific options to pass

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.attach lawrence
        salt '*' zoneadm.attach lawrence True
    r/Trz+zoneadm -z {zone} attach{force}{brand_opts}z -Fr0r3)r�force�
brand_optsrrr	r:r;r<�rr?r@)rrSrTrErGr
r
r�attachR�
��rVcCrJ)z�
    Prepares a zone for running applications.

    zone : string
        name or uuid of the zone

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.ready clementine
    r/Trzzoneadm {zone} readyr6r7rrrr	r:r;r<r0rKrLr
r
r�readywrQrXcCsrddi}tddj|d��}|ddk|d<|dr|dn|d	|d
<|d
�dd�|d
<|d
dkr7|d
=|S)
z�
    Check to make sure the configuration of the specified
    zone can safely be installed on the machine.

    zone : string
        name of the zone

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.verify dolores
    r/Trzzoneadm -z {zone} verifyrrrr	r:r;r<r0rUrLr
r
r�verify�s��rYcCs�ddi}tddjt|�rd|��nd|��|d��}|dd	k|d<|dr+|d
n|d|d<|d�d
d�|d<|ddkrD|d=|S)z�
    Move zone to new zonepath.

    zone : string
        name or uuid of the zone
    zonepath : string
        new zonepath

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.move meave /sweetwater/meave
    r/Trzzoneadm {zone} move {path}r6r7)rrrrr	r:r;r<r0rK)rZzonepathrErGr
r
r�move�s��rZcCrJ)a
    Uninstall the specified zone from the system.

    zone : string
        name or uuid of the zone

    .. warning::
        The -F flag is always used to avoid the prompts when uninstalling.

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.uninstall teddy
    r/Trzzoneadm {zone} uninstall -Fr6r7rrrr	r:r;r<r0rKrLr
r
r�	uninstall�rNr[cCrR)ab
    Install the specified zone from the system.

    zone : string
        name of the zone
    nodataset : boolean
        do not create a ZFS file system
    brand_opts : string
        brand specific options to pass

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.install dolores
        salt '*' zoneadm.install teddy True
    r/Trz0zoneadm -z {zone} install{nodataset}{brand_opts}z
 -x nodatasetr0r3)r�	nodatasetrTrrr	r:r;r<rU)rr\rTrErGr
r
r�install�rWr]cCs�ddi}tddj|||rd|�d�ndd��}|d	d
k|d<|dr(|dn|d|d
<|d
�dd�|d
<|d
dkrA|d
=|S)aB
    Install a zone by copying an existing installed zone.

    zone : string
        name of the zone
    source : string
        zone to clone from
    snapshot : string
        optional name of snapshot to use as source

    CLI Example:

    .. code-block:: bash

        salt '*' zoneadm.clone clementine dolores
    r/Trz*zoneadm -z {zone} clone {snapshot}{source}r1r3r0)r�source�snapshotrrr	r:r;r<rU)rr^r_rErGr
r
r�clones��r`)TFFT)FNN)FFNN)FN)N)�__doc__�loggingZsalt.utils.decoratorsrZsalt.utils.path�	getLogger�__name__�logrZ__func_alias__rZ
decoratorsZmemoizerrr rrHrIrMrOrPrVrXrYrZr[r]r`r
r
r
r�<module>s0




2
32
!5
%!
!%