%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/omapi.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZej	e
�ZyddlZ
eZWnek
r�ZeZnXd�Zd�Zddeded�Zddd�ZdS(u�
This module interacts with an ISC DHCP Server via OMAPI.
server_ip and server_port params may be set in the minion
config or pillar:

.. code-block:: yaml

  omapi.server_ip: 127.0.0.1
  omapi.server_port: 7991

:depends: pypureomapi Python module
i(tabsolute_importtprint_functiontunicode_literalsNcC@str
dStdfS(u+
    Confirm pypureomapi is available.
    uomapiu]The omapi execution module cannot be loaded: the pypureomapi python library is not available.(t
omapi_supporttFalse(((s6/usr/lib/python2.7/site-packages/salt/modules/omapi.pyt__virtual__"scC@s�tjdtjdd��}tjdtjdd��}tjdtjdd��}tjdtjdd��}|r�tjjj|�}n|r�tjjj|�}ntj	||d|d|�S(	Nuomapi.server_ipu	127.0.0.1uomapi.server_porti7u	omapi.keyu
omapi.usertusernametkey(
t
__pillar__tgett__opts__tNonetsalttutilststringutilstto_bytestomapitOmapi(t	server_iptserver_portRR((s6/usr/lib/python2.7/site-packages/salt/modules/omapi.pyt_conn,s				c
C@s�d}t�}tjjd�}|jjdtjdd�f�|jjdtjdd�f�|jjdtj	|�f�|jjdtjdd�f�|r�|jjd	tj
|�f�n|r�|jjd
tjj
j|�f�n|r*|jjdtjj
j|�f�n|rF|dj|�7}n|rh|rh|d
j|�7}n|r�|jjdtjj
j|�f�n|j|�}	|	jtjkr�tStS(uH
    Add a host object for the given mac.

    CLI Example:

    .. code-block:: bash

        salt dhcp-server omapi.add_host ab:ab:ab:ab:ab:ab name=host1

    Add ddns-hostname and a fixed-ip statements:

    .. code-block:: bash

        salt dhcp-server omapi.add_host ab:ab:ab:ab:ab:ab name=host1 ip=10.1.1.1 ddns=true
    uthosttcreates!Iit	exclusiveshardware-addresss
hardware-types
ip-addresstnametgroupuoption host-name "{0}"; uddns-hostname "{0}"; t
statements(RRtOmapiMessagetopentmessagetappendtstructtpacktobjtpack_mactpack_ipRR
RRtformattquery_servertopcodetOMAPI_OP_UPDATERtTrue(
tmacRtiptddnsRtsupersede_hostRtotmsgtresponse((s6/usr/lib/python2.7/site-packages/salt/modules/omapi.pytadd_host<s.	""""(((cC@s|p	|std��nt�}tjjd�}|r�|jjdtj|�f�|jjdtj	dd�f�n|r�|jjdt
jjj
|�f�n|j|�}|jtjkr�d	S|jdkr�tS|jtjj|j��}|jtjkrtStS(
u�
    Delete the host with the given mac or name.

    CLI Examples:

    .. code-block:: bash

        salt dhcp-server omapi.delete_host name=host1
        salt dhcp-server omapi.delete_host mac=ab:ab:ab:ab:ab:ab
    u!At least one argument is requiredRshardware-addresss
hardware-types!IiRiN(t	TypeErrorRRRRR!RR"RR RR
RRR%R&R'RthandleRtdeletetOMAPI_OP_STATUSR((R)RR-R.R/((s6/usr/lib/python2.7/site-packages/salt/modules/omapi.pytdelete_hostfs$	%((t__doc__t
__future__RRRtloggingRtsalt.utils.stringutilsRt	getLoggert__name__tlogtpypureomapiRR(RtImportErrorteRRRRR0R5(((s6/usr/lib/python2.7/site-packages/salt/modules/omapi.pyt<module>
s

	
	)

Zerion Mini Shell 1.0