o ckF[@sDddlZddlZddlmZmZddlZddlZGdddeZdS)N) ShellCommandget_tsc@sBeZdZdddZdddZddZd d Zdd dZddZdS) ScriptBaseNcCs<tjddd|_|jj|_t|_|rtj |dSdS)NInstancez instance-iddefault) botoconfigget instance_id __class____name__namertsread)self config_filer7/usr/lib/python3/dist-packages/boto/pyami/scriptbase.py__init__ s  zScriptBase.__init__cCstj||dSN)rutilsnotify)rsubjectbodyrrrrszScriptBase.notifycCs>tj|szt|WdStjd|YdSdS)NzError creating directory: %s)ospathisdirmkdirrlogerrorrrrrrrs zScriptBase.mkdircCs"tj|r|d|dSdS)Nz umount %s)rrismountrunr!rrrumounts zScriptBase.umountTFcCsdt||d|_|jjdkr.tjd||jjf|r'|dd||jjf|r.t d|jjS)N)cwdrz)Error running command: "%s". Output: "%s"zError encounteredz=Error running the following command: %s Command output: %s) r last_commandstatusrrr outputrsysexit)rcommandr exit_on_errorr%rrrr#s   zScriptBase.runcCsdSrr)rrrrmain*szScriptBase.mainr)r)TFN) r __module__ __qualname__rrrr$r#r.rrrrrs    r)rr* boto.utilsrrrobjectrrrrrs