From 1c0f0706a1b542c5377eba57cafca50832dad278 Mon Sep 17 00:00:00 2001 From: Marvin Martinson Date: Wed, 29 Sep 2021 09:14:05 +0000 Subject: [PATCH] Remove mongo init from code --- pinecrypt/server/cli.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/pinecrypt/server/cli.py b/pinecrypt/server/cli.py index 3f758b4..58066c0 100644 --- a/pinecrypt/server/cli.py +++ b/pinecrypt/server/cli.py @@ -215,34 +215,6 @@ def pinecone_serve_builder(): @click.command("provision", help="Provision keys") def pinecone_provision(): - # First thing init mongo db - click.echo("Provisioning MongoDB replicaset") - # WTF https://github.com/docker-library/mongo/issues/339 - c = pymongo.MongoClient("localhost", 27017) - - if const.INIT_MONGO: - mongo_uri = pymongo.uri_parser.parse_uri(const.MONGO_URI) - - for ip_port in mongo_uri["nodelist"]: - try: - ipaddress.ip_address(ip_port[0]) - except ValueError: - click.echo("Right now mongo address must be IP, no domin names allowed") - raise ValueError("Right now mongo address must be IP, no domin names allowed like %s" % ip_port[0]) - - config = {"_id": "rs0", "members": [ - {"_id": index, "host": "%s:%s" % (ip_port[0], ip_port[1])} for index, ip_port in enumerate(mongo_uri["nodelist"])]} - - # config = {"_id":"rs0", "members": [ - # {"_id": 0, "host": "127.0.0.1:27017"}]} - print("Provisioning MongoDB replicaset: %s" % repr(config)) - - try: - c.admin.command("replSetInitiate", config) - except pymongo.errors.OperationFailure: - print("Looks like it's already initialized") - pass - # Expand variables distinguished_name = cn_to_dn(const.AUTHORITY_COMMON_NAME)