Load server groups and servers.
(input_file: str, user: Optional[str] = None,
auth_source: Optional[str] = INTERNAL,
sqlite_path: Optional[str] = None,
replace: Optional[bool] = False
)
| 105 | @app.command() |
| 106 | @update_sqlite_path |
| 107 | def load_servers(input_file: str, user: Optional[str] = None, |
| 108 | auth_source: Optional[str] = INTERNAL, |
| 109 | sqlite_path: Optional[str] = None, |
| 110 | replace: Optional[bool] = False |
| 111 | ): |
| 112 | |
| 113 | """Load server groups and servers.""" |
| 114 | |
| 115 | # What user? |
| 116 | load_user = user if user is not None else config.DESKTOP_USER |
| 117 | |
| 118 | print('----------') |
| 119 | print('Loading servers with:') |
| 120 | print('User:', load_user) |
| 121 | print('SQLite pgAdmin config:', config.SQLITE_PATH) |
| 122 | print('----------') |
| 123 | |
| 124 | try: |
| 125 | app = create_app(config.APP_NAME + '-cli') |
| 126 | with app.test_request_context(): |
| 127 | if replace: |
| 128 | clear_database_servers(load_user, True, auth_source) |
| 129 | load_database_servers(input_file, None, load_user, True, |
| 130 | auth_source) |
| 131 | except Exception as e: |
| 132 | print(str(e)) |
| 133 | |
| 134 | |
| 135 | class AuthExtTypes(str, Enum): |
nothing calls this directly
no test coverage detected