Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/module_utils/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyc

�
�Udac@s�ddlZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZdZ
yhddlmZmZmZddlmZmZddlmZdd	lmZddlZeZWn#ek
r�ej�Z
eZnXej d
�Z!de"fd��YZ#d
e$fd��YZ%de$fd��YZ&de$fd��YZ'de$fd��YZ(d�Z)dd�Z*dS(i����N(t
AnsibleModuletmissing_required_lib(tconfigparser(t
expanduser(tUUID(t
API_ENDPOINTStDimensionDataAPIExceptiontDimensionDataStatus(tNodetNodeLocation(t
get_driver(tProviders.*MCP\s?2.*tDimensionDataModulecBsheZdZd�Zd�Zd�Zd�Zd�Zed��Z	ed��Z
ed��ZRS(	sd
    The base class containing common functionality used by Dimension Data modules for Ansible.
    cCsN||_ts1|jjdtd�dt�n|j�}|d|_|d|_|jjd}dj	|�|_
|jjd|_|jjd	tj
_ttj�|j|jd|j
�|_|j|j�|_d
|jjkr/|jjd
|_|jjd|_|jjd|_nt|_d
|_d
|_dS(s�
        Create a new DimensionDataModule.

        Will fail if Apache libcloud is not present.

        :param module: The underlying Ansible module.
        :type module: AnsibleModule
        tmsgtlibcloudt	exceptiontuser_idtkeytregionsdd-{0}tlocationtvalidate_certstwaitt	wait_timetwait_poll_intervaliN(tmoduletHAS_LIBCLOUDt	fail_jsonRtLIBCLOUD_IMP_ERRtget_credentialsRRtparamstformatRRRtsecuritytVERIFY_SSL_CERTR
Rt
DIMENSIONDATAtdrivertget_mcp_versiontmcp_versionRRRtFalse(tselfRtcredentialsR((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyt__init__>s,
	"

			cCsts|jjdd�nd}d}d|jjkr�d|jjkrb|jjdd�n|jjd}|jjd}n|s�|r�tjjdd�}tjjdd�}n|s�|rBtd�}t	j
�}|jd	|�y(|jd
d�}|jd
d�}WqBt	jt	j
fk
r>qBXn|sWtd��n|sltd��ntd
|d|�S(s�
        Get user_id and key from module configuration, environment, or dotfile.
        Order of priority is module, environment, dotfile.

        To set in environment:

            export MCP_USER='myusername'
            export MCP_PASSWORD='mypassword'

        To set in dot file place a file at ~/.dimensiondata with
        the following contents:

            [dimensiondatacloud]
            MCP_USER: myusername
            MCP_PASSWORD: mypassword
        R
s%libcloud is required for this module.tmcp_usertmcp_passwordsg"mcp_user" parameter was specified, but not "mcp_password" (either both must be specified, or neither).tMCP_USERtMCP_PASSWORDt~s%s/.dimensiondatatdimensiondataclouds Dimension Data user id not foundsDimension Data key not foundRRN(RRRtNoneRtostenvirontgetRRtRawConfigParsertreadtNoSectionErrort
NoOptionErrortMissingCredentialsErrortdict(R&RRthometconfig((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyRls6
cCs,|jj|�}tj|j�r(dSdS(sA
        Get the MCP version for the specified location.
        s2.0s1.0(R"tex_get_location_by_idtMCP_2_LOCATION_NAME_PATTERNtmatchtname(R&R((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyR#�scCs�t|�r!|jj|�}nPg|jjd|�D]}|j|kr7|^q7}|rk|d}nd}|r{|Std|��dS(s>
        Retrieve a network domain by its name or Id.
        RisNetwork '%s' could not be foundN(tis_uuidR"tex_get_network_domaintex_list_network_domainsR>R/tUnknownNetworkError(R&tlocatorRtnetwork_domaintmatching_network_domains((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pytget_network_domain�s
cCs�t|�r!|jj|�}nPg|jj||�D]}|j|kr7|^q7}|rk|d}nd}|r{|Std|��dS(s5
        Get a VLAN object by its name or id
        isVLAN '%s' could not be foundN(R?R"tex_get_vlant
ex_list_vlansR>R/tUnknownVLANError(R&RCRRDtvlantmatching_vlans((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pytget_vlan�s
cKs�tdtdddd�dtdddt�dtdddtd	t�d
tdddt�dtdddtdt��}|r�|j|�n|S(
s
        Build an argument specification for a Dimension Data module.
        :param additional_argument_spec: An optional dictionary representing the specification for additional module arguments (if any).
        :return: A dict containing the argument specification.
        RttypetstrtdefaulttnaR)trequiredR*tno_logRRtbool(R8R%tTruetupdate(tadditional_argument_spectspec((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyt
argument_spec�sc
Kswtjdtdddtdt�dtdddtdd�d	tdddtdd
��}|rs|j|�n|S(sD
        Build an argument specification for a Dimension Data module that includes "wait for completion" arguments.
        :param additional_argument_spec: An optional dictionary representing the specification for additional module arguments (if any).
        :return: A dict containing the argument specification.
        RRMRSRQRORtintiXRi(RRXR8R%RU(RVRW((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pytargument_spec_with_wait�s	cGs)ddgg}|r%|j|�n|S(sl
        Get the basic argument specification for Dimension Data modules indicating which arguments are must be specified together.
        :param additional_required_together: An optional list representing the specification for additional module arguments that must be specified together.
        :return: An array containing the argument specifications.
        R)R*(textend(tadditional_required_togethertrequired_together((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyR]	s	(t__name__t
__module__t__doc__R(RR#RFRLtstaticmethodRXRZR](((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyR9s	.	=			tLibcloudNotFoundcBseZdZRS(s@
    Exception raised when Apache libcloud cannot be found.
    (R^R_R`(((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyRbsR7cBseZdZRS(s\
    Exception raised when credentials for Dimension Data CloudControl cannot be found.
    (R^R_R`(((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyR7#sRBcBseZdZRS(sL
    Exception raised when a network or network domain cannot be found.
    (R^R_R`(((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyRB+sRIcBseZdZRS(s7
    Exception raised when a VLAN cannot be found.
    (R^R_R`(((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyRI3scCs<tj�}g|D]}|jd�r|d^q}|S(sK
    Get the list of available regions whose vendor is Dimension Data.
    sdd-i(Rtkeyst
startswith(tall_regionsRtregions((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pytget_dd_regions;s,icCs?y&t|d|�}t|�|kSWntk
r:tSXdS(s
    Test if valid v4 UUID
    tversionN(RRNt
ValueErrorR%(tuRhtuuid_obj((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyR?Is

(+R0tret	tracebacktansible.module_utils.basicRRtansible.module_utils.six.movesRtos.pathRtuuidRR/Rtlibcloud.common.dimensiondataRRRtlibcloud.compute.baseRR	tlibcloud.compute.providersR
tlibcloud.compute.typesRtlibcloud.securityRRTRtImportErrort
format_excR%tcompileR<tobjectRt	ExceptionRbR7RBRIRgR?(((sF/usr/lib/python2.7/site-packages/ansible/module_utils/dimensiondata.pyt<module>s2


�	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]