This is an automated email from the ASF dual-hosted git repository.

omartushevskyi pushed a commit to branch DLAB-515
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-515 by this push:
     new 1c43eb9  [DLAB-515]: fixed issue with Ubuntu version change
1c43eb9 is described below

commit 1c43eb9822a16f82d0258e6dcfd05e6a7e38ad4b
Author: Oleh Martushevskyi <[email protected]>
AuthorDate: Thu Mar 26 13:47:37 2020 +0200

    [DLAB-515]: fixed issue with Ubuntu version change
---
 .../src/general/lib/os/debian/ssn_lib.py              |  8 ++++++--
 .../src/ssn/scripts/configure_mongo.py                | 19 +++++++++++++++----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py 
b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
index c5b949e..9acfa16 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
@@ -161,8 +161,12 @@ def ensure_supervisor():
 def ensure_mongo():
     try:
         if not exists(os.environ['ssn_dlab_path'] + 'tmp/mongo_ensured'):
-            manage_pkg('-y install', 'remote', 'mongodb')
-            sudo('systemctl enable mongodb.service')
+            sudo('wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc 
| apt-key add -')
+            sudo('ver=`lsb_release -cs`; echo "deb [ arch=amd64,arm64 ] 
https://repo.mongodb.org/apt/ubuntu '
+                 '$ver/mongodb-org/4.2 multiverse" | sudo tee 
/etc/apt/sources.list.d/mongodb-org-4.2.list; '
+                 'apt-get update')
+            manage_pkg('-y ', 'remote', 'mongodb-org')
+            sudo('systemctl enable mongod.service')
             sudo('touch ' + os.environ['ssn_dlab_path'] + 'tmp/mongo_ensured')
     except Exception as err:
         traceback.print_exc()
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py 
b/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py
index e04242b..1d93fda 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py
@@ -28,7 +28,7 @@ import time
 import argparse
 from dlab.fab import *
 
-path = "/etc/mongodb.conf"
+path = "/etc/mongod.conf"
 outfile = "/etc/mongo_params.yml"
 
 parser = argparse.ArgumentParser()
@@ -59,13 +59,24 @@ def add_2_yml_config(path, section, param, value):
         return False
 
 
+def read_yml_conf(path, section, param):
+    try:
+        with open(path, 'r') as config_yml:
+            config = yaml.load(config_yml)
+        result = config[section][param]
+        return result
+    except:
+        print("File does not exist")
+        return ''
+
+
 if __name__ == "__main__":
     mongo_passwd = "PASSWORD"
-    mongo_ip = '127.0.0.1'
-    mongo_port = '27017'
+    mongo_ip = read_yml_conf(path,'net','bindIp')
+    mongo_port = read_yml_conf(path,'net','port')
     #mongo_parameters = json.loads(args.mongo_parameters)
     # Setting up admin's password and enabling security
-    client = MongoClient(mongo_ip + ':' + mongo_port)
+    client = MongoClient(mongo_ip + ':' + str(mongo_port))
     pass_upd = True
     try:
         command = ['service', 'mongod', 'start']


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to