Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To python3, add main.py to release #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/tasks/build-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ run:
cd $GOPATH/src/github.com/dispatchframework/dispatch-ui
npm install
npm run build
cp main.py ./build/
tar -czvf dispatch-ui.tar.gz ./build
mv dispatch-ui.tar.gz $GOPATH/dispatch-ui-binaries/
13 changes: 10 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/python
from flask import Flask, request
import argparse
import os

app = Flask(__name__)

org = "dispatch-server"
def add_header(args):
args.append('"Cookie: cookie"')
args.append('"X-Dispatch-Org: default"')
args.append('"X-Dispatch-Org: %s"' % org)
args.append('"accept: application/json"')
args.append('"content-type: application/json"')

Expand Down Expand Up @@ -65,10 +67,15 @@ def run():
add_header(args)
args.append('"Accept-Encoding: gzip"')
cmd = " -H ".join(args)
cmd += " -d '%s'" % request.data
cmd += " -d '%s'" % request.data.decode("utf-8")
resp = os.popen(cmd).read()
return resp, 200, {'Access-Control-Allow-Origin': '*'}


if __name__ == '__main__':
app.run()
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--organization", help="Organization name, default: dispatch-server")
args = parser.parse_args()
if args.organization:
org = args.organization
app.run()