Browse Source

Added connection arguments check

Roland Haroutiounian 8 years ago
parent
commit
a37fc6da2d
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      plugins/mongodb_datasource/migration_handler.py

+ 4
- 0
plugins/mongodb_datasource/migration_handler.py View File

38
         if len(conn_args.keys()) == 0:
38
         if len(conn_args.keys()) == 0:
39
             raise MigrationHandlerError("No connection arguments were given")
39
             raise MigrationHandlerError("No connection arguments were given")
40
 
40
 
41
+        if 'host' not in conn_args.keys() or 'port' not in conn_args.keys() or 'db_name' not in conn_args.keys() \
42
+            or 'username' not in conn_args.keys() or 'password' not in conn_args.keys():
43
+            raise MigrationHandlerError("Missing connection arguments")
44
+
41
         #self.connection_name = conn_args['name']
45
         #self.connection_name = conn_args['name']
42
         self.database = connect(host=conn_args['host'], port=conn_args['port'], db_name=conn_args['db_name'],
46
         self.database = connect(host=conn_args['host'], port=conn_args['port'], db_name=conn_args['db_name'],
43
                                 username=conn_args['username'], password=conn_args['password'])
47
                                 username=conn_args['username'], password=conn_args['password'])

Loading…
Cancel
Save