ó ¡ôXc@s†ddlmZddlmZmZmZddlmZddlm Z ddl m Z ddl m Z defd„ƒYZd S( iÿÿÿÿ(tArg(t IAMRequestt AS_ACCOUNTtarg_role(tDeleteRolePolicy(tListInstanceProfilesForRole(tListRolePolicies(tRemoveRoleFromInstanceProfilet DeleteRolec BsqeZdZeddƒeddddddddƒed d dddddd ƒegZd „Zd „Z RS(s Delete a rolethelps%name of the role to delete (required)s-cs --recursivetactiont store_truetroute_tosGremove all IAM resources associated with the role firsts-ps --pretendshlist the resources that would be deleted instead of actually deleting them. Implies -c.c Cs|jjdƒs$|jjdƒr!tj|d|jdd|jjdƒƒ}|jƒ}g}xJ|jdƒpygD]3}|ji|jdƒd6|jdƒd 6ƒqzWtj|d|jdd|jjdƒƒ}|jƒ}g}x9|jd ƒpgD]}|j|ƒqWn g}g}|jjdƒrQi|d 6|d 6S|jjdƒrxP|D]H}tj|d|jdd|d d|jjdƒƒ}|jƒqjWxO|D]D}tj|d|jdd |d|jjdƒƒ}|jƒq½Wn|j ƒS(Nt recursivetpretendtRoleNametDelegateAccounttInstanceProfilestArntarntInstanceProfileNametnamet PolicyNamestinstance_profilestpoliciest PolicyName( targstgetRt from_othertmaintappendRRRtsend(tselftreqtresponseRtprofileRtpolicy((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleterole.pyR0sH$      cCsc|jjdƒr_dGHx|dD]}d|dGHq"WdGHx|dD]}d|GHqIWndS(NRsinstance profilesRs RR(RR(R tresultR#R$((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleterole.pyt print_result[sN( t__name__t __module__t DESCRIPTIONRRtNoneRtARGSRR&(((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleterole.pyR%s   +N(trequestbuilderRteuca2ools.commands.iamRRRt'euca2ools.commands.iam.deleterolepolicyRt2euca2ools.commands.iam.listinstanceprofilesforroleRt'euca2ools.commands.iam.listrolepoliciesRt4euca2ools.commands.iam.removerolefrominstanceprofileRR(((sE/usr/lib/python2.7/site-packages/euca2ools/commands/iam/deleterole.pyts