This function is used to validate the specified utilities path by running the utilities with their versions.
()
| 324 | methods=["POST"]) |
| 325 | @pga_login_required |
| 326 | def validate_binary_path(): |
| 327 | """ |
| 328 | This function is used to validate the specified utilities path by |
| 329 | running the utilities with their versions. |
| 330 | """ |
| 331 | data = None |
| 332 | if hasattr(request.data, 'decode'): |
| 333 | data = request.data.decode('utf-8') |
| 334 | |
| 335 | if data != '': |
| 336 | data = json.loads(data) |
| 337 | |
| 338 | version_str = '' |
| 339 | |
| 340 | # Do not allow storage dir as utility path |
| 341 | if 'utility_path' in data and data['utility_path'] is not None and \ |
| 342 | Path(config.STORAGE_DIR) != Path(data['utility_path']) and \ |
| 343 | Path(config.STORAGE_DIR) not in Path(data['utility_path']).parents: |
| 344 | binary_versions = get_binary_path_versions(data['utility_path']) |
| 345 | for utility, version in binary_versions.items(): |
| 346 | if version is None: |
| 347 | version_str += "<b>" + utility + ":</b> " + \ |
| 348 | "not found on the specified binary path.<br/>" |
| 349 | else: |
| 350 | version_str += "<b>" + utility + ":</b> " + version + "<br/>" |
| 351 | else: |
| 352 | return precondition_required(gettext('Invalid binary path.')) |
| 353 | |
| 354 | return make_json_response(data=gettext(version_str), status=200) |
| 355 | |
| 356 | |
| 357 | @blueprint.route("/upgrade_check", endpoint="upgrade_check", |
nothing calls this directly
no test coverage detected