This function checks the utility file exist on the given path. Args: sid: Server ID backup_obj_type: Type of the object Returns: None
(sid, backup_obj_type)
| 513 | ) |
| 514 | @pga_login_required |
| 515 | def check_utility_exists(sid, backup_obj_type): |
| 516 | """ |
| 517 | This function checks the utility file exist on the given path. |
| 518 | |
| 519 | Args: |
| 520 | sid: Server ID |
| 521 | backup_obj_type: Type of the object |
| 522 | Returns: |
| 523 | None |
| 524 | """ |
| 525 | server = get_server(sid) |
| 526 | |
| 527 | if server is None: |
| 528 | return make_json_response( |
| 529 | success=0, |
| 530 | errormsg=SERVER_NOT_FOUND |
| 531 | ) |
| 532 | |
| 533 | from pgadmin.utils.driver import get_driver |
| 534 | driver = get_driver(PG_DEFAULT_DRIVER) |
| 535 | manager = driver.connection_manager(server.id) |
| 536 | |
| 537 | utility = manager.utility('backup') if backup_obj_type == 'objects' \ |
| 538 | else manager.utility('backup_server') |
| 539 | |
| 540 | ret_val = does_utility_exist(utility) |
| 541 | if ret_val: |
| 542 | return make_json_response( |
| 543 | success=0, |
| 544 | errormsg=ret_val |
| 545 | ) |
| 546 | |
| 547 | return make_json_response(success=1) |
| 548 | |
| 549 | |
| 550 | @blueprint.route( |
nothing calls this directly
no test coverage detected