def launch_satellite(cli):
cli.info("<STR_LIT>")<EOL>finish = wait_for("<STR_LIT>")<EOL>destroy_satellite(cli)<EOL>url = '<STR_LIT>'<EOL>try:<EOL><INDENT>cli.user.post(url, {<EOL>'<STR_LIT:name>': APPNAME,<EOL>'<STR_LIT>': '<STR_LIT>'<EOL>})<EOL><DEDENT>except RESTAPIError as e:<EOL><INDENT>if e.code == <NUM_LIT>:<EOL><INDENT>cli.die('<STR_LIT>'.format(APPNAME))<EOL><DEDENT>else:<EOL><INDENT>cli.die('<STR_LIT>'.format(APPNAME, e))<EOL><DEDENT><DEDENT>class args: application = APPNAME<EOL>protocol = '<STR_LIT>'<EOL>url = '<STR_LIT>'.format(APPNAME, '<STR_LIT>')<EOL>endpoint = cli._select_endpoint(cli.user.get(url).items, protocol)<EOL>class args: path = satellite_path<EOL>cli.push_with_rsync(args, endpoint)<EOL>revision = None<EOL>clean = False<EOL>url = '<STR_LIT>'.format(APPNAME)<EOL>response = cli.user.post(url, {'<STR_LIT>': revision, '<STR_LIT>': clean})<EOL>deploy_trace_id = response.trace_id<EOL>deploy_id = response.item['<STR_LIT>']<EOL>original_stdout = sys.stdout<EOL>finish = wait_for("<STR_LIT>", finish, original_stdout)<EOL>try:<EOL><INDENT>sys.stdout = StringIO()<EOL>res = cli._stream_deploy_logs(APPNAME, deploy_id,<EOL>deploy_trace_id=deploy_trace_id, follow=True)<EOL>if res != <NUM_LIT:0>:<EOL><INDENT>return res<EOL><DEDENT><DEDENT>except KeyboardInterrupt:<EOL><INDENT>cli.error('<STR_LIT>''<STR_LIT>')<EOL>cli.error('<STR_LIT>''<STR_LIT>''<STR_LIT>'<EOL>.format(deploy_trace_id))<EOL>cli.error('<STR_LIT>''<STR_LIT>'.format(<EOL>cli._fmt_deploy_logs_command(deploy_id)))<EOL>cli.die()<EOL><DEDENT>except RuntimeError:<EOL><INDENT>pass<EOL><DEDENT>finally:<EOL><INDENT>sys.stdout = original_stdout<EOL><DEDENT>finish = wait_for("<STR_LIT>", finish)<EOL>endpoint = lookup_endpoint(cli)<EOL>ok = client.check_skypipe_endpoint(endpoint, <NUM_LIT>)<EOL>finish.set()<EOL>time.sleep(<NUM_LIT:0.1>) <EOL>if ok:<EOL><INDENT>return endpoint<EOL><DEDENT>else:<EOL><INDENT>cli.die("<STR_LIT>")<EOL><DEDENT>
Deploys a new satellite app over any existing app