Skip to content

Commit

Permalink
Add authenticationDatabase param to MongoTask command.
Browse files Browse the repository at this point in the history
Making the requirements Python 3.5 compatible.
Allow passing empty username to the mongoexport command.
Avoid failing on non-string values.
  • Loading branch information
Squirrel18 committed Jan 6, 2021
1 parent 0fa8e83 commit d57571b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion exporter/mysql_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ def _write_results_to_tsv(self, cursor, output_file):

def _normalize_value(self, value):
if value is None: value='NULL'
return six.text_type(value).encode('utf-8').replace('\\', '\\\\').replace('\r', '\\r').replace('\t','\\t').replace('\n', '\\n')
return six.text_type(value).replace('\\', '\\\\').replace('\r', '\\r').replace('\t','\\t').replace('\n', '\\n')
3 changes: 2 additions & 1 deletion exporter/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ class MongoTask(Task):
mongoexport
--host {mongo_host}
--db {mongo_db}
--username {mongo_user}
--authenticationDatabase "{mongo_auth_db}"
--username "{mongo_user}"
--password "{mongo_password}"
--collection {mongo_collection}
--query '{query}'
Expand Down
2 changes: 2 additions & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ docopt
edx-ccx-keys
edx-opaque-keys
graphitesend
mysql-connector-python
path
path.py
pbr
pip
Expand Down
25 changes: 14 additions & 11 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,34 @@
#
# make upgrade
#
awscli==1.18.174 # via -r requirements/base.in
botocore==1.19.14 # via awscli, s3transfer
awscli==1.18.204 # via -r requirements/base.in
botocore==1.19.44 # via awscli, s3transfer
colorama==0.4.3 # via awscli
docopt==0.6.2 # via -r requirements/base.in
docutils==0.15.2 # via awscli
edx-ccx-keys==1.1.0 # via -r requirements/base.in
edx-opaque-keys==2.1.1 # via -r requirements/base.in, edx-ccx-keys
edx-opaque-keys==2.1.0 # via -c requirements/constraints.txt, -r requirements/base.in, edx-ccx-keys
graphitesend==0.10.0 # via -r requirements/base.in
importlib-metadata==2.0.0 # via stevedore
importlib-metadata==1.6.0 # via -c requirements/constraints.txt, path
jmespath==0.10.0 # via botocore
more-itertools==8.6.0 # via zipp
mysql-connector-python==8.0.22 # via -r requirements/base.in
path.py==12.5.0 # via -r requirements/base.in
path==15.0.0 # via path.py
path==13.1.0 # via -c requirements/constraints.txt, -r requirements/base.in, path.py
pbr==5.5.1 # via -r requirements/base.in, stevedore
psutil==5.7.3 # via -r requirements/base.in
protobuf==3.14.0 # via mysql-connector-python
psutil==5.8.0 # via -r requirements/base.in
pyasn1==0.4.8 # via rsa
pymongo==3.11.0 # via -r requirements/base.in, edx-opaque-keys
pymongo==3.11.2 # via -r requirements/base.in, edx-opaque-keys
python-dateutil==2.8.1 # via -r requirements/base.in, botocore
python-gnupg==0.4.6 # via -r requirements/base.in
pyyaml==5.3.1 # via -r requirements/base.in, awscli
rsa==4.5 # via awscli
s3transfer==0.3.3 # via awscli
six==1.15.0 # via edx-ccx-keys, edx-opaque-keys, python-dateutil
stevedore==3.2.2 # via edx-opaque-keys
urllib3==1.25.11 # via botocore
zipp==3.4.0 # via importlib-metadata
six==1.15.0 # via edx-ccx-keys, edx-opaque-keys, protobuf, python-dateutil, stevedore
stevedore==1.32.0 # via -c requirements/constraints.txt, edx-opaque-keys
urllib3==1.26.2 # via botocore
zipp==1.0.0 # via -c requirements/constraints.txt, importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
8 changes: 8 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# edx-platform Juniper version compatible.
edx-opaque-keys==2.1.0

# Python 3.5 compatible.
path==13.1.0
stevedore==1.32.0
importlib-metadata==1.6.0
zipp==1.0.0
11 changes: 10 additions & 1 deletion sample-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ defaults:
django_cms_settings: cms-django-settings e.g. cms.envs.devstack_docker
django_database: the_django_database
mongo_collection: name-of-the-mongo-collection
sql_user: user-name
sql_user: mysql-username
sql_db: name-of-the-edxapp-db e.g. edxapp
sql_password: mysql-password
secret_key: ''
monitor: false
graphite_host: localhost
Expand All @@ -30,8 +31,13 @@ environments:
django_config: /prod/django/config
mongo_host: 0.0.0.0:9999
mongo_db: the_mongo_db
mongo_user: the_mongo_username
mongo_password: the_mongo_password
mongo_auth_db: authentication-database-name
name: prod-mongodb
sql_host: prod-sql-host.example.com
lms_config: path-to-the-lms-yml-config-file
studio_config: path-to-the-studio-yml-config-file
edge:
django_config: /edge/django/config
mongo_host: 0.0.0.0:8888
Expand All @@ -44,8 +50,11 @@ environments:
mongo_db: edxapp
mongo_user: edxapp
mongo_password: password
mongo_auth_db: authentication-database-name
name: local-mongodb This name will be used to create the Mongo DB files.
sql_host: edx.devstack.mysql
lms_config: path-to-the-lms-yml-config-file
studio_config: path-to-the-studio-yml-config-file

organizations:
edX:
Expand Down

0 comments on commit d57571b

Please sign in to comment.