??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
 Udac@s>ddlZddlZddlZddlmZmZddlmZddlmZddl m Z ddl m Z yYddl mZddlZddljZddljZeejedkZWnek reZnXid d d 6d d d 6d dd6d dd6d dd6ZdZeeedZdZdZ dZ!dZ"dZ#edZ$edZ%dZ&edZ'e(edZ)d d!e(d"d#Z*d$Z+d%Z,d&Z-d'Z.d(Z/d)Z0d*Z1d+e2fd,YZ3d-Z4d.e fd/YZ5dS(0iN(tABCMetatabstractmethod(tdatetime(t LooseVersion(t CloudRetry(tMapping(tEnums4.3.0ii tkibitmibitgibi(ttibi2tpibcCsts|jddndS(Ntmsgs=ovirtsdk4 version 4.3.0 or higher is required for this module(tHAS_SDKt fail_json(tmodule((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt check_sdk3s csi}fdfdfd|dk rxN|jjD]:\}}|dkrqan|}|||/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pys Gstidthref(t follow_linktsdktErrorRtdictR(Rt nested_obj(t attributest connectionR(Rs>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt resolve_href@s  cs*|jdr&|d}|n|S(Nt_i(t startswith(tval(tremove_underscore(s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyR$Ns  c st}t|tjr= s)|j r3t|S|St|ts[t|tret|St|t st|tj rt|tj rr|jryj |}t }Wqtj k rg}qXng}x|D]ttjr| r1r1jr1|jq|sM|jtqtfdD}tdd|d<|j|qttr|jtq|jqW|S|SdS(Nc3s<|]2}t|dr|t|fVqdS(N(RR(RR(Rti(s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pys osR(tFalset isinstanceRtStructRtget_dict_of_structRRtstrtlisttListRtTrueRtappendRRR(RtnestedtretR(RRRt fetch_nestedR (R%s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRTs>   !!    N(Rt__dict__titems(tstructRR1RtrestkeyR((RRRR1R$R s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyR):s(   cCs2|jj}|jj}d|j|jfS(s? Return string representation of oVirt engine version. s%s.%s(tsystem_servicetgett product_infotversiontmajortminor(Rt engine_apitengine_version((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyR>s cCs|jd}|d krK|jdd k rKdj|jd}ntjd|d|jdd|jdd|jdd d|jdtd|jdd d |jd d d |jd d S( sK Create a connection to Python SDK, from task `auth` parameter. If user doesnt't have SSO token the `auth` dictionary has following parameters mandatory: url, username, password If user has SSO token the `auth` dictionary has following parameters mandatory: url, token The `ca_file` parameter is mandatory in case user want to use secure connection, in case user want to use insecure connection, it's mandatory to send insecure=True. :param auth: dictionary which contains needed values for connection creation :return: Python SDK connection turlthostnameshttps://{0}/ovirt-engine/apitusernametpasswordtca_filetinsecurettokentkerberostheadersN(R8RtformatRt ConnectionR&(tauthR?((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytcreate_connections! cCs|dkrdSdj|j}t|dkru|djdkrut|d tj|djd S|jrt|dSt d j d |dS(sq This method convert units to bytes, which follow IEC standard. :param param: value to be converted tiitktmtgtttpiii s+Unsupported value(IEC supported): '{value}'RN(RMRNRORPRQi( Rtjointsplittlentlowertintt BYTES_MAPR8tisdigitt ValueErrorRH(tparam((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytconvert_to_bytess (( cCs|r|j|SdSdS(s This method returns the entity of the element which link points to. :param connection: connection to the Python SDK :param link: link of the entity :return: entity which link points to N(RR(Rtlink((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRs  cCs|r|j|jSdSdS(s This method returns the name of the element which link points to. :param connection: connection to the Python SDK :param link: link of the entity :return: name of the entity, which link points to N(RtnameR(RR\((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt get_link_names cCs6|dk r2|r(|j|jkS||kStS(s Compare two parameters and return if they are equal. This parameter doesn't run equal operation if first parameter is None. With this approach we don't run equal operation in case user don't specify parameter in their task. :param param1: user inputted parameter :param param2: value of entity parameter :return: True if parameters are equal or first parameter is None, otherwise False N(RRUR-(tparam1tparam2t ignore_case((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytequals  c Ks|p i}dtj|jdkrY|jddjd|jD|}nqg|j|D][}tg|jD]*\}}t||d|kr|^qt|kri|^qi}|pdg}|dS(s Search for the entity by attributes. Nested entities don't support search via REST, so in case using search for nested entity we return all entities and filter them by specified attributes. tsearchis and css'|]\}}dj||VqdS(s {0}="{1}"N(RH(RRMtv((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pys sN(tinspectt getargspecR+RRR3RTRR(tservicet list_paramstkwargsR5teRMRd((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytsearch_by_attributess   =c Ksdtj|jdkr=|jddjd|}n.g|jD]}|j|krJ|^qJ}|rg|jD][}tg|jD]*\}}t||d|kr|^qt|kr~|^q~}n|pdg}|dS(s> Search for the entity by its name. Nested entities don't support search via REST, so in case using search for nested entity we return all entities and filter them by name. :param service: service of the entity :param name: name of the entity :return: Entity object returned by Python SDK Rcis name="{name}"R]N( ReRfR+RHR]RTR3RR(RgR]RiR5RjRMRd((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytsearch_by_names  .=cCsOd}y.|dk r'|j|}n |j}Wntjk rJnX|S(sE Ignore SDK Error in case of getting an entity from service. N(RR8RR(Rgt get_paramstentity((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt get_entity.s cCs?t||}|dk r"|jS|r;td|ndS(s+ Search an entity ID by it's name. sEntity '%s' was not found.N(RlRRt Exception(RgR]t raise_errorRaRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytget_id_by_name?s  cCstS(N(R&(Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytOsiicCs|rtj}xdtj||krxt|}||rGdS||rbtdntjt|qWtdndS(s Wait until entity fulfill expected condition. :param service: service of the entity :param condition: condition to be fulfilled :param fail_condition: if this condition is true, raise Exception :param timeout: max time to wait in seconds :param wait: if True wait for condition, if False don't wait :param poll_interval: Number of seconds we should wait until next condition check Ns2Error while waiting on result state of the entity.s;Timeout exceed while waiting on result state of the entity.(ttimeRoRptsleeptfloat(Rgt conditiontfail_conditionttimeouttwaitt poll_intervaltstartRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRzLs    c Cs0tjjd}tjjd}tjjd}tjjd}tjjd}tjjd}|dk}d}|dkr|dk rdj|}n|r|r|s|ri|d6|d 6|d 6|d 6|d 6|d 6}n|dk rtd|dd}ntdtdd}|S(Nt OVIRT_URLtOVIRT_HOSTNAMEtOVIRT_USERNAMEtOVIRT_PASSWORDt OVIRT_TOKENt OVIRT_CAFILEshttps://{0}/ovirt-engine/apiR?RARBRDRERCtdefaultttypeRtrequired(tostenvironR8RRHRR-( R}R~RRRRtOVIRT_INSECUREtenv_varsRJ((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt__get_auth_dictos,   c KsPtdtdtdtdddtdddt}|j||S(s Extend parameters of info module with parameters which are common to all oVirt info modules. :param kwargs: kwargs to be extended :return: extended dictionary with common parameters RJR1RRtbooltnested_attributesR+(RRR&R+tupdate(Ritspec((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytovirt_info_full_argument_specs   cKs t|S(s This is deprecated. Please use ovirt_info_full_argument_spec instead! :param kwargs: kwargs to be extended :return: extended dictionary with common parameters (R(Ri((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytovirt_facts_full_argument_specscKstdtdtdddddtdtddd tdd ddd tdtddd tdd dt}|j||S(s Extend parameters of module with parameters which are common to all oVirt modules. :param kwargs: kwargs to be extended :return: extended dictionary with common parameters RJRyRiRRVRzRR{iR1RR+(RRR-R&R+R(RiR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytovirt_full_argument_specs  cCsG|jjddkrC|jjddkrC|jddndS(sA Most modules must have either `name` or `id` specified. R]RR s"name" or "id" is requiredN(tparamsR8RR(R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt check_paramss0cCstt|t|kS(N(RR>(RR:((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytengine_supportedscCsjtt|}t|}xE|D]=}|jj|dk r%ttj|koa||kSq%WtS(sb Check if parameters used by user are supported by oVirt Python SDK and oVirt engine. N(RR>RR8Rt sdk_versiontVERSIONR-(R:RRRt api_versionRZ((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt check_supports   #t BaseModulecBs(eZdZeZedZedZej dZe dZ ddZ dZdZdZd Zd Zddd ddded Zd ZdZdddZddddddddZddZdddZdZdZRS(s  This is base class for oVirt modules. oVirt modules should inherit this class and override method to customize specific needs of the module. The only abstract method of this class is `build_entity`, which must to be implemented in child class. cCsE||_||_||_||_itd6td6|_dS(Ntaftertbefore(t _connectiont_modulet_servicet_changedRt_diff(tselfRRRgtchanged((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt__init__s     cCs|jS(N(R(R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRscCs|js||_ndS(N(R(RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRs cCsdS(sP This method should return oVirt Python SDK type, which we want to create or update, initialized by values passed by Ansible module. For example if we want to create VM, we will return following: types.Vm(name=self._module.params['vm_name']) :return: Specific instance of sdk.Struct. N((R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt build_entitys cCs|jjj||S(sC Return a module parameter specified by it's name. (RRR8(RR]R((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRZscCstS(sA This method handle checks whether the entity values are same as values passed to ansible module. By default we don't compare any values. :param entity: Entity we want to compare with Ansible module values. :return: True if values are same, so we don't need to update the entity. (R-(RRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt update_checkscCsdS(s This method is called right before entity is created. :param entity: Entity to be created or updated. N((RRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt pre_create scCsdS(sx This method is called right after entity is created. :param entity: Entity which was created. N((RRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt post_createscCsdS(sx This method is called right after entity is updated. :param entity: Entity which was updated. N((RRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt post_updatescCsfx_|jD]Q\}}t|trP|j|j|t|||/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyR#s (cCstS(N(R&(Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRs/sc sz|dkr%| r%|j|}n|j||r|jj|j} |j|s]|j} |jj s|p}i}| j | |} |j |n|jj rt ||jdtddg} | j} |j| t | | |j d<| |j d/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytstate_conditionxscs|o|jkS(N(tstatus(Rn(t result_state(s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyR}sRgRwRxRzRyR{RRR4RRtdiffN(Rt search_entityRRRgRRRRt check_modeRRRR)RR-tcopyRRtaddRRzRRR8Rt__name__RU(RRnRRxt search_paramst update_paramst_waitt force_createRitentity_servicet new_entitytupdated_entityRRR((Rs>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytcreate+sf                 "  (cCsdS(s This method is called right before entity is removed. :param entity: Entity which we want to remove. N((RRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt pre_removescCs1djdt|jjdt|ddS(Ns{e_type} '{e_name}'te_typete_nameR](RHRRRURR(RRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt entity_names c Ks6|dkr|j|}n|dkr?i|jd6dd6S|j||jj|j}|jjs|j |t d|ddd|jj dd|jj dd |jj d nt |_i|jd6|jd 6t d |d |jd |jj jd d|jj jdt|jj6S(sb Method which is called when state of the entity is 'absent'. If user don't provide `entity` parameter the entity is searched using `search_params` parameter. If entity is found it's removed. Function executed before remove is executed can optionally be specified in `pre_remove` parameter. :param entity: Entity we want to remove. :param search_params: Dictionary of parameters to be used for search. :param kwargs: Additional parameters passed when removing entity. :return: Dictionary with values returned by Ansible module. RsEntity wasn't found.R RgRwcSs| S(N((Rn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRssRzRyR{RR4RR1RRN(RRRRRRgRRRtremoveRzRR-R)RR8RRRU(RRnRRiR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRs2           cCs|S(N((Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRsscCs|S(N((Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRsscCstS(N(R&(Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRsscCs|S(N((Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRsscCsdS(N(R(Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRssc Ks|dkr|j|}n||}|dkrU|jjddj|n|jj|j} | j}||r|jj st | || nt |_ n||t d|jj|jd|d|d|jjdd|jjdd|jjdi|j d 6|jd 6td |d |jd |jjjd d|jjjdt|jj6|jd6S(s This method is executed when we want to change the state of some oVirt entity. The action to be executed on oVirt service is specified by `action` parameter. Whether the action should be executed can be specified by passing `action_condition` parameter. State which the entity should be in after execution of the action can be specified by `wait_condition` parameter. Function executed before an action on entity can optionally be specified in `pre_action` parameter. Function executed after an action on entity can optionally be specified in `post_action` parameter. :param action: Action which should be executed by service on entity. :param entity: Entity we want to run action on. :param action_condition: Function which is executed when checking if action should be executed. :param fail_condition: Function which checks incorrect state of entity, if it returns `True` Exception is raised. :param wait_condition: Function which is executed when waiting on result state. :param pre_action: Function which is executed before running the action. :param post_action: Function which is executed after running the action. :param search_params: Dictionary of parameters to be used for search. :param kwargs: Additional parameters passed to action. :return: Dictionary with values returned by Ansible module. R s)Entity not found, can't run action '{0}'.RgRwRxRzRyR{RRR4RR1RRRN(RRRRRHRRgRR8RRR-RRzRR)RRRRUR( RtactionRntaction_conditiontwait_conditionRxt pre_actiont post_actionRRiR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRs<#             (cCstS(N(R-(Rj((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRsscCs|jjdrtj}|jjd}|jjd}xLtj||kr|j}|rw||rw|Stj|q?WndS(NRzRyR{(RRRtRRu(RRwR|RyR{Rn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytwait_for_imports  cCsd}d|jjkrY|jjddk rYt|jj|jjdd|}nj|dk rt|jd||}nC|jjjddk rt|jd|d|jjd}n|S(s Always first try to search by `ID`, if ID isn't specified, check if user constructed special search in `search_params`, if not search by `name`. RRmRhR]N(RRRRoRRgRkR8(RRRhRn((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyR*s(+ (cCsR|dks|dkrdSt|tjr;t|jSt|jddS(NRLt.i(RR'totypestVersionRVR;RS(Rt full_version((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt _get_major;s  cCsR|dks|dkrdSt|tjr;t|jSt|jddS(NRLRi(RR'RRRVR<RS(RR((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt _get_minorBs  N(Rt __module__t__doc__Rt __metaclass__R&RtpropertyRtsetterRRRRZRRRRRRRRRRRRRR(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRsB       b  3 C  cCstr tjStdS(s2 Allow for ovirtsdk4 not being installed. N(R RRRR(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyt_sdk4_error_maybeJst OvirtRetrycBs2eZeZedZeddZRS(cCs|jS(N(tcode(terror((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytstatus_code_from_exceptionVscCs)dg}|r|j|n||kS(Ni(textend(t response_codetcatch_extra_error_codestretry_on((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pytfoundZs N(RRRt base_classt staticmethodRRR(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyRSs (6ReRRttabcRRRtdistutils.versionRtansible.module_utils.cloudRt/ansible.module_utils.common._collections_compatRtenumRt ovirtsdk4Rtovirtsdk4.versionR:Rtovirtsdk4.typesttypesRRR t ImportErrorR&RWRRR)R>RKR[RR^RbRkRlRoR-RrRzRRRRRRRtobjectRRR(((s>/usr/lib/python2.7/site-packages/ansible/module_utils/ovirt.pyts`           M              v