o .&ßamã@sTddlZddlZddlZddlZddlmZddlmZmZm Z Gdd„deƒZ dS)éN)Ú BasicCommand)Úvalidate_regionÚvalidate_s3_locationÚvalidate_instancec@sdeZdZdZdZdddddœdd d d d œd dd ddœgZdd„Zdd„Zdd„Zdd„Z dd„Z dS)ÚInstallÚinstallzMConfigures and installs the AWS CodeDeploy Agent on the on-premises instance.z config-filez--config-file TzBRequired. The path to the on-premises instance configuration file.)ÚnameÚsynopsisÚrequiredÚ help_textzoverride-configÚ store_trueFz@Optional. Overrides the on-premises instance configuration file.)rÚactionÚdefaultr zagent-installerz--agent-installer z2Optional. The AWS CodeDeploy Agent installer file.c Csš|}|j|_t||ƒt|ƒ|j ¡| |¡| |¡z | |¡|  |¡WdSt yL}zt j   ¡t j d |¡¡WYd}~dSd}~ww)NzÍERROR {0} Install the AWS CodeDeploy Agent on the on-premises instance by following the instructions in "Configure Existing On-Premises Instances by Using AWS CodeDeploy" in the AWS CodeDeploy User Guide. )Ú_sessionÚsessionrrÚsystemÚvalidate_administratorÚ_validate_override_configÚ_validate_agent_installerÚ_create_configÚ_install_agentÚ ExceptionÚsysÚstdoutÚflushÚstderrÚwriteÚformat)ÚselfÚ parsed_argsÚparsed_globalsÚparamsÚe©r#úJ/usr/lib/python3/dist-packages/awscli/customizations/codedeploy/install.pyÚ _run_main=s$      ú€þzInstall._run_maincCs&tj |jj¡r|jstdƒ‚dSdS)Nz•The on-premises instance configuration file already exists. Specify --override-config to update the existing on-premises instance configuration file.)ÚosÚpathÚisfilerÚ CONFIG_PATHÚoverride_configÚ RuntimeError©rr!r#r#r$rTsÿÿþz!Install._validate_override_configcCsjt|dƒd|vrd |j¡|_d|vr#d |jj¡|_|jj|_dS|j d¡d}|j|d…|_dS)NÚagent_installerÚbucketzaws-codedeploy-{0}Úkeyz latest/{0}ú/é) rrÚregionr.rÚ INSTALLERr/Ú installerÚrfind)rr!Ústartr#r#r$r]s z!Install._validate_agent_installerc Cs„tj d¡z t |jj¡Wnty)}z|jtj kr|‚WYd}~nd}~ww|j |jj kr:t   |j |jj ¡tj d¡dS)Nz8Creating the on-premises instance configuration file... úDONE )rrrr&ÚmakedirsrÚ CONFIG_DIRÚOSErrorÚerrnoÚEEXISTÚ config_filer)ÚshutilÚcopyfile)rr!r"r#r#r$rhsÿ  ÿ€ÿzInstall._create_configcCs(tj d¡|j |¡tj d¡dS)Nz'Installing the AWS CodeDeploy Agent... r7)rrrrrr,r#r#r$rus  zInstall._install_agentN) Ú__name__Ú __module__Ú __qualname__ÚNAMEÚ DESCRIPTIONÚ ARG_TABLEr%rrrrr#r#r#r$rs2ÿû û ûí  r) r;r&r>rÚawscli.customizations.commandsrÚ&awscli.customizations.codedeploy.utilsrrrrr#r#r#r$Ús