def promote_pipeline(conf, args):
src = conf.config['<STR_LIT>'][args.src_instance]<EOL>src_url = api.build_pipeline_url(build_instance_url(src))<EOL>src_auth = tuple([conf.creds['<STR_LIT>'][args.src_instance]['<STR_LIT:user>'], conf.creds['<STR_LIT>'][args.src_instance]['<STR_LIT>']])<EOL>verify_ssl = src.get('<STR_LIT>', True)<EOL>export_json = api.export_pipeline(src_url, args.src_pipeline_id, src_auth, verify_ssl)<EOL>dest = conf.config['<STR_LIT>'][args.dest_instance]<EOL>dest_url = api.build_pipeline_url(build_instance_url(dest))<EOL>dest_auth = tuple([conf.creds['<STR_LIT>'][args.dest_instance]['<STR_LIT:user>'], conf.creds['<STR_LIT>'][args.dest_instance]['<STR_LIT>']])<EOL>dest_pipeline_id = args.dest_pipeline_id<EOL>if dest_pipeline_id and api.pipeline_status(dest_url, dest_pipeline_id, dest_auth, verify_ssl)['<STR_LIT:status>'] != api.STATUS_STOPPED:<EOL><INDENT>api.stop_pipeline(dest_url, dest_pipeline_id, dest_auth, verify_ssl)<EOL><DEDENT>else:<EOL><INDENT>create_json = api.create_pipeline(dest_url, dest_auth, export_json, verify_ssl)<EOL>dest_pipeline_id = create_json['<STR_LIT:info>']['<STR_LIT>']<EOL><DEDENT>result = api.import_pipeline(dest_url, dest_pipeline_id, dest_auth, export_json, verify_ssl, overwrite=True)<EOL>if args.start_dest:<EOL><INDENT>api.start_pipeline(dest_url, dest_pipeline_id, dest_auth, verify_ssl)<EOL><DEDENT>return result<EOL>
Export a pipeline from a lower environment and import into higher environment.