diff options
author | Nikolay Zamotaev <nzamotaev@luxoft.com> | 2020-01-31 19:56:06 +0300 |
---|---|---|
committer | Nikolay Zamotaev <nzamotaev@luxoft.com> | 2020-02-14 14:07:05 +0000 |
commit | 9c45aeb3aafe236093b96021d5c6b170f9c4b126 (patch) | |
tree | 78aecccd997a206329ffc65f408f8a51cc30b3ca | |
parent | 647a3b6e0dbfce90ac24712c19ae0a4bfa596103 (diff) |
Support for reporting wrong architecture in /hello status
Task-number: AUTOSUITE-1438
Change-Id: Id02885b829c21641da456f99e054541b09cf964e
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
(cherry picked from commit a095cc3470c473f123c032f3fcfc599e006dad40)
Reviewed-by: Nikolay Zamotaev <nzamotaev@luxoft.com>
-rw-r--r-- | doc/src/deployment-server-reference.qdoc | 7 | ||||
-rw-r--r-- | store/api.py | 5 | ||||
-rw-r--r-- | store/osandarch.py | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/doc/src/deployment-server-reference.qdoc b/doc/src/deployment-server-reference.qdoc index c49c3d2..b81bd7f 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 de975dd..09b6550 100644 --- a/store/api.py +++ b/store/api.py @@ -65,7 +65,10 @@ def hello(request): break request.session[j] = str(versionmap) if 'architecture' in getRequestDictionary(request): - request.session['architecture'] = normalizeArch(getRequestDictionary(request)['architecture']) + arch = normalizeArch(getRequestDictionary(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 |