diff options
author | Nikolay Zamotaev <nzamotaev@luxoft.com> | 2020-02-03 17:19:21 +0300 |
---|---|---|
committer | Nikolay Zamotaev <nzamotaev@luxoft.com> | 2020-02-04 12:06:19 +0000 |
commit | a3a443e68e0b1c99e4a82ff6c89bfed206eec800 (patch) | |
tree | b110d2bb17cbefb05ae0d1f269a98e2521cc3d1a | |
parent | af559c314224584ca656ff5bc1136fdff4ad8400 (diff) |
Support for reporting wrong architecture in /hello status
Task-number: AUTOSUITE-1438
Change-Id: Iae0bf4b5402c8aad14dac98d94c98b06f3fbecf1
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
-rw-r--r-- | doc/src/deployment-server-reference.qdoc | 7 | ||||
-rw-r--r-- | store/api.py | 6 | ||||
-rw-r--r-- | store/osandarch.py | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/doc/src/deployment-server-reference.qdoc b/doc/src/deployment-server-reference.qdoc index c49c3d2..53baa53 100644 --- a/doc/src/deployment-server-reference.qdoc +++ b/doc/src/deployment-server-reference.qdoc @@ -78,7 +78,7 @@ \li Value \li Description \row - \li {1,5} status + \li {1,6} status \li ok \li Successful \row @@ -91,6 +91,9 @@ \li incompatible-version \li The API version you are using is not compatible. \row + \li incompatible-architecture + \li The architecture parameter was malformed or server was unable to parse it. + \row \li malformed-tag \li The tag format is incorrect, may not be alphanumeric, or could not be parsed. @@ -444,4 +447,4 @@ seconds. \endlist -*/
\ No newline at end of file +*/ diff --git a/store/api.py b/store/api.py index 0ed54b1..aab1c09 100644 --- a/store/api.py +++ b/store/api.py @@ -44,6 +44,7 @@ from authdecorators import logged_in_or_basicauth, is_staff_member from models import App, Category, Vendor, savePackageFile from utilities import parsePackageMetadata, parseAndValidatePackageMetadata, addSignatureToPackage from utilities import packagePath, iconPath, downloadPath +from osandarch import normalizeArch from tags import SoftwareTagList @@ -65,7 +66,10 @@ def hello(request): break request.session[j] = str(versionmap) if 'architecture' in request.REQUEST: - request.session['architecture'] = normalizeArch(request.REQUEST['architecture']) + arch = normalizeArch(request.REQUEST['architecture']) + if arch == "": + status = 'incompatible-architecture' + request.session['architecture'] = arch else: request.session['architecture'] = '' return JsonResponse({'status': status}) diff --git a/store/osandarch.py b/store/osandarch.py index 9a2db12..0dde800 100644 --- a/store/osandarch.py +++ b/store/osandarch.py @@ -138,6 +138,8 @@ def normalizeArch(inputArch): """ parts = inputArch.split('-') + if len(parts) <4: + return "" # Invalid format #Drop anything non-numeric from word_size field parts[2]=re.sub(r"\D", "", parts[2]) #Transform kernelType into binary format |