From 837e64887859e55c31916a82b9929ce521835666 Mon Sep 17 00:00:00 2001
From: cuixucui <350255958@qq.com>
Date: Thu, 18 Jun 2020 11:05:38 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E7=A0=81=E8=A7=84=E8=8C=83=E6=95=B4?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/misc.xml | 7 +
.idea/modules.xml | 8 +
.idea/oec-hardware.iml | 12 ++
.idea/vcs.xml | 6 +
.idea/workspace.xml | 364 ++++++++++++++++++++++++++++++++++
hwcompatible/compatibility.py | 10 +-
server/server.py | 46 ++---
7 files changed, 425 insertions(+), 28 deletions(-)
create mode 100644 .idea/misc.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/oec-hardware.iml
create mode 100644 .idea/vcs.xml
create mode 100644 .idea/workspace.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..7da51bc
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..e6eb0b6
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/oec-hardware.iml b/.idea/oec-hardware.iml
new file mode 100644
index 0000000..7c9d48f
--- /dev/null
+++ b/.idea/oec-hardware.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..67b8a26
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,364 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CertCommandError
+ cert_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1592261845556
+
+
+ 1592261845556
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hwcompatible/compatibility.py b/hwcompatible/compatibility.py
index fa63987..09576cc 100755
--- a/hwcompatible/compatibility.py
+++ b/hwcompatible/compatibility.py
@@ -104,10 +104,10 @@ class EulerCertification():
factory_doc = FactoryDocument(CertEnv.factoryfile)
self.test_factory = factory_doc.get_factory()
- cert_id = self.certification.get_certify()
+ oec_id = self.certification.get_certify()
hardware_info = self.certification.get_hardware()
- self.client = Client(hardware_info, cert_id)
- print(" Compatibility Test ID: ".ljust(30) + cert_id)
+ self.client = Client(hardware_info, oec_id)
+ print(" Compatibility Test ID: ".ljust(30) + oec_id)
print(" Hardware Info: ".ljust(30) + hardware_info)
print(" Product URL: ".ljust(30) + self.certification.get_url())
print(" OS Info: ".ljust(30) + self.certification.get_os())
@@ -168,9 +168,9 @@ class EulerCertification():
def upload(self, path, server):
print("Uploading...")
if not self.client:
- cert_id = self.certification.get_certify()
+ oec_id = self.certification.get_certify()
hardware_info = self.certification.get_hardware()
- self.client = Client(hardware_info, cert_id)
+ self.client = Client(hardware_info, oec_id)
return self.client.upload(path, server)
def get_tests(self, devices):
diff --git a/server/server.py b/server/server.py
index 54b0cce..677db18 100755
--- a/server/server.py
+++ b/server/server.py
@@ -40,17 +40,17 @@ dir_files = os.path.join(dir_server, 'files')
@app.errorhandler(400)
-def bad_request():
+def bad_request(e):
return render_template('error.html', error='400 - Bad Request'), 400
@app.errorhandler(404)
-def page_not_found():
+def page_not_found(e):
return render_template('error.html', error='404 - Page Not Found'), 404
@app.errorhandler(500)
-def internal_server_error():
+def internal_server_error(e):
return render_template('error.html', error='500 - Internal Server Error'), 500
@@ -65,15 +65,15 @@ def get_results():
for host in next(os.walk(dir_results))[1]:
dir_host = os.path.join(dir_results, host)
results[host] = {}
- for cert_id in next(os.walk(dir_host))[1]:
- dir_id = os.path.join(dir_host, cert_id)
+ for oec_id in next(os.walk(dir_host))[1]:
+ dir_id = os.path.join(dir_host, oec_id)
results[host][id] = next(os.walk(dir_id))[1]
return render_template('results.html', results=results)
@app.route('/results///')
-def get_job(host, cert_id, job):
- dir_job = os.path.join(dir_results, host, cert_id, job)
+def get_job(host, oec_id, job):
+ dir_job = os.path.join(dir_results, host, oec_id, job)
json_info = os.path.join(dir_job, 'compatibility.json')
json_results = os.path.join(dir_job, 'factory.json')
try:
@@ -83,12 +83,12 @@ def get_job(host, cert_id, job):
results = json.load(f)
except (IOError, json.decoder.JSONDecodeError) as e:
abort(404)
- return render_template('job.html', host=host, id=cert_id, job=job, info=info, results=results)
+ return render_template('job.html', host=host, id=oec_id, job=job, info=info, results=results)
@app.route('/results////devices/')
-def get_device(host, cert_id, job, interface):
- dir_job = os.path.join(dir_results, host, cert_id, job)
+def get_device(host, oec_id, job, interface):
+ dir_job = os.path.join(dir_results, host, oec_id, job)
json_results = os.path.join(dir_job, 'factory.json')
try:
with open(json_results, 'r') as f:
@@ -104,8 +104,8 @@ def get_device(host, cert_id, job, interface):
@app.route('/results////devices')
-def get_devices(host, cert_id, job):
- dir_job = os.path.join(dir_results, host, cert_id, job)
+def get_devices(host, oec_id, job):
+ dir_job = os.path.join(dir_results, host, oec_id, job)
json_devices = os.path.join(dir_job, 'device.json')
try:
with open(json_devices, 'r') as f:
@@ -116,8 +116,8 @@ def get_devices(host, cert_id, job):
@app.route('/results////attachment')
-def get_attachment(host, cert_id, job):
- dir_job = os.path.join(dir_results, host, cert_id, job)
+def get_attachment(host, oec_id, job):
+ dir_job = os.path.join(dir_results, host, oec_id, job)
attachment = dir_job + '.tar.gz'
filedir = os.path.dirname(attachment)
filename = os.path.basename(attachment)
@@ -125,8 +125,8 @@ def get_attachment(host, cert_id, job):
@app.route('/results////logs/')
-def get_log(host, cert_id, job, name):
- dir_job = os.path.join(dir_results, host, cert_id, job)
+def get_log(host, oec_id, job, name):
+ dir_job = os.path.join(dir_results, host, oec_id, job)
logpath = os.path.join(dir_job, name + '.log')
if not os.path.exists(logpath):
logpath = os.path.join(dir_job, 'job.log')
@@ -139,8 +139,8 @@ def get_log(host, cert_id, job, name):
@app.route('/results////submit')
-def submit(host, cert_id, job):
- dir_job = os.path.join(dir_results, host, cert_id, job)
+def submit(host, oec_id, job):
+ dir_job = os.path.join(dir_results, host, oec_id, job)
tar_job = dir_job + '.tar.gz'
json_cert = os.path.join(dir_job, 'compatibility.json')
try:
@@ -181,14 +181,14 @@ def submit(host, cert_id, job):
@app.route('/api/job/upload', methods=['GET', 'POST'])
def upload_job():
host = request.values.get('host', '').strip().replace(' ', '-')
- cert_id = request.values.get('id', '').strip().replace(' ', '-')
+ oec_id = request.values.get('id', '').strip().replace(' ', '-')
job = request.values.get('job', '').strip().replace(' ', '-')
filetext = request.values.get('filetext', '')
- if not(all([host, cert_id, job, filetext])):
- return render_template('upload.html', host=host, id=cert_id, job=job,
+ if not(all([host, oec_id, job, filetext])):
+ return render_template('upload.html', host=host, id=id, job=job,
filetext=filetext, ret='Failed'), 400
- dir_job = os.path.join(dir_results, host, cert_id, job)
+ dir_job = os.path.join(dir_results, host, oec_id, job)
tar_job = dir_job + '.tar.gz'
if not os.path.exists(dir_job):
os.makedirs(dir_job)
@@ -199,7 +199,7 @@ def upload_job():
except (IOError, OSError) as e:
print(e)
abort(400)
- return render_template('upload.html', host=host, id=cert_id, job=job,
+ return render_template('upload.html', host=host, id=oec_id, job=job,
filetext=filetext, ret='Successful')
--
GitLab