summaryrefslogtreecommitdiff
path: root/bin/update/upload_build_config.py
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-09-06 04:48:44 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-05-19 03:43:22 +0200
commit7f52e3848e8b153f8a0b6bb7eef4f40afabe7e69 (patch)
treea19fad240fe462bb0b4f1ab05cf5c15ecdcf5793 /bin/update/upload_build_config.py
parent94fd45a29d8302886e132aaf4f8b75b6903e8536 (diff)
move most of the updater settings to ini file
Also finally add the initial version of the upload scripts. Change-Id: I3ad5bcbeba60f0cf9700e5fe5001a24f162a3244
Diffstat (limited to 'bin/update/upload_build_config.py')
-rwxr-xr-xbin/update/upload_build_config.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/update/upload_build_config.py b/bin/update/upload_build_config.py
new file mode 100755
index 000000000000..0380cc1c323b
--- /dev/null
+++ b/bin/update/upload_build_config.py
@@ -0,0 +1,40 @@
+#! /usr/bin/env python3
+
+import sys
+import os
+import configparser
+import requests
+
+dir_path = os.path.dirname(os.path.realpath(__file__))
+
+def main(argv):
+
+ updater_config = sys.argv[2]
+
+ config = configparser.ConfigParser()
+ config.read(updater_config)
+
+ user = config["Updater"]["User"]
+ password = config["Updater"]["Password"]
+ base_address = config["Updater"]["ServerURL"]
+
+ login_url = base_address + "accounts/login/"
+
+ session = requests.session()
+ r1 = session.get(login_url)
+ csrftoken = session.cookies['csrftoken']
+
+ login_data = { 'username': user,'password': password,
+ 'csrfmiddlewaretoken': csrftoken }
+ r1 = session.post(login_url, data=login_data, headers={"Referer": login_url})
+
+ url = base_address + "update/upload/release"
+
+ build_config = os.path.join(sys.argv[1], "build_config.json")
+ r = session.post(url, files={'release_config': open(build_config, "r")})
+ print(r.content)
+ if r.status_code != 200:
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main(sys.argv)