Merge branch 'dev'
This commit is contained in:
commit
081b323621
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user