我正在尝试在 GCP 函数中运行 bash 脚本,但不知何故它不起作用。这是我的函数,它基本上将文件(代理)导出到 Google Apigee:
def test2(request):
cmd = "python ./my-proxy/tools/deploy.py -n myProxy -u userName:!password -o myOrg -e test -d ./my-proxy -p /"
# no block, it start a sub process.
p = subprocess.Popen(cmd , shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# and you can block util the cmd execute finish
p.wait()
# or stdout, stderr = p.communicate()
return "Proxy deployed to Apigee"
Run Code Online (Sandbox Code Playgroud)
这是我的deploy.py文件:
!/usr/bin/env python
import base64
import getopt
import httplib
import json
import re
import os
import …Run Code Online (Sandbox Code Playgroud)