o .&ßaú ã@s‚ddlZddlZddlmZddlmZddlmZe e¡Z dd„Z dd„Z d d „Z d d „Z d d„Zdd„ZGdd„deƒZdS)éN)ÚConfigFileWriter)Ú EC2_ROLE_NAME)Ú EMR_ROLE_NAMEcCs| ¡ di¡S)NÚemr)Úget_scoped_configÚget©Úsession©r úG/usr/lib/python3/dist-packages/awscli/customizations/emr/configutils.pyÚ get_configssr cCs| d¡}|dur dS|S)NÚprofileÚdefault©Úget_config_variable)r Ú profile_namer r r Úget_current_profile_names rcCs t|dƒS)NÚ.)Ú_get_profile_strrr r r Úget_current_profile_var_name s rcCs"| d¡}|dur dSd||fS)Nr rz profile%c%sr)r Ú separatorrr r r r$s   ÿrcCs t|ƒ}d|vs d|vrdSdS)NÚinstance_profileÚ service_roleTF)r )r Úparsed_configsr r r Úis_any_role_configured*s ÿþrcCsDt|ƒr t d¡dSt|ƒ}| dt¡| dt¡t d¡dS)NzJAt least one of the roles is already associated with your current profile rrz2Associated default roles with your current profile)rÚLOGÚdebugÚ ConfigWriterÚ update_configrr)r Ú config_writerr r r Ú update_roles1s   r c@seZdZdd„Zdd„ZdS)rcCs||_t|dƒ|_tƒ|_dS)Nú )r rÚsectionrÚconfig_file_writer)Úselfr r r r Ú__init__>s  zConfigWriter.__init__cCs6tj |j d¡¡}|j||idœ}|j ||¡dS)NÚ config_file)Ú __section__r)ÚosÚpathÚ expanduserr rr"r#r)r$ÚkeyÚvalueÚconfig_filenameÚupdated_configr r r rCs ÿÿzConfigWriter.update_configN)Ú__name__Ú __module__Ú __qualname__r%rr r r r r<s r)Úloggingr(Ú&awscli.customizations.configure.writerrÚ#awscli.customizations.emr.constantsrrÚ getLoggerr/rr rrrrr Úobjectrr r r r Ús