(s)
| 289 | |
| 290 | |
| 291 | def connection_from_string(s): |
| 292 | protocol, user, pw, host, port, db, collection, authdb = parse_url(s) |
| 293 | if protocol == "mongo": |
| 294 | ssh = False |
| 295 | elif protocol in ("mongo+ssh", "ssh+mongo"): |
| 296 | ssh = True |
| 297 | else: |
| 298 | raise ValueError("unrecognized protocol for MongoJobs", protocol) |
| 299 | connection, tunnel = connection_with_tunnel( |
| 300 | dbname=db, ssh=ssh, user=user, pw=pw, host=host, port=port, auth_dbname=authdb |
| 301 | ) |
| 302 | return connection, tunnel, connection[db], connection[db][collection] |
| 303 | |
| 304 | |
| 305 | class MongoJobs: |
no test coverage detected