Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions lms/djangoapps/dashboard/management/commands/git_add_course.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ def add_repo(repo, rdir_in):
# Allow overrides
if hasattr(settings, 'MONGODB_LOG'):
for config_item in ['host', 'user', 'password', 'db', ]:
if hasattr(settings.MONGODB_LOG, config_item):
mongo_db[config_item] = settings.MONGODB_LOG.get(
config_item, mongo_db[config_item])
mongo_db[config_item] = settings.MONGODB_LOG.get(
config_item, mongo_db[config_item])

if not os.path.isdir(GIT_REPO_DIR):
log.critical(_("Path {0} doesn't exist, please create it, "
Expand Down Expand Up @@ -119,8 +118,8 @@ def add_repo(repo, rdir_in):
except CommandError:
log.exception(_('Unable to run import command.'))
return -1
except NotImplementedError, ex:
log.critical(_('The underlying module store does not support import.'))
except NotImplementedError:
log.exception(_('The underlying module store does not support import.'))
return -1

ret_import = output.getvalue()
Expand Down Expand Up @@ -148,7 +147,7 @@ def add_repo(repo, rdir_in):

if os.path.exists(cdir) and not os.path.islink(cdir):
log.debug(_(' -> exists, but is not symlink'))
log.debug(subprocess.check_output(['ls', 'l', ],
log.debug(subprocess.check_output(['ls', '-l', ],
cwd=os.path.abspath(cdir)))
try:
os.rmdir(os.path.abspath(cdir))
Expand All @@ -165,9 +164,7 @@ def add_repo(repo, rdir_in):
cwd=os.path.abspath(cdir)))

# store import-command-run output in mongo
mongouri = 'mongodb://{0}:{1}@{2}/{3}'.format(
mongo_db['user'], mongo_db['password'],
mongo_db['host'], mongo_db['db'])
mongouri = 'mongodb://{user}:{password}@{host}/{db}'.format(**mongo_db)

try:
if mongo_db['user'] and mongo_db['password']:
Expand Down
16 changes: 6 additions & 10 deletions lms/djangoapps/dashboard/sysadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,13 +644,10 @@ def get(self, request, *args, **kwargs):
# Allow overrides
if hasattr(settings, 'MONGODB_LOG'):
for config_item in ['host', 'user', 'password', 'db', ]:
if hasattr(settings.MONGODB_LOG, config_item):
mongo_db[config_item] = settings.MONGODB_LOG.get(
config_item, mongo_db[config_item])
mongo_db[config_item] = settings.MONGODB_LOG.get(
config_item, mongo_db[config_item])

mongouri = 'mongodb://{0}:{1}@{2}/{3}'.format(
mongo_db['user'], mongo_db['password'],
mongo_db['host'], mongo_db['db'])
mongouri = 'mongodb://{user}:{password}@{host}/{db}'.format(**mongo_db)

error_msg = ''

Expand All @@ -659,10 +656,9 @@ def get(self, request, *args, **kwargs):
mdb = mongoengine.connect(mongo_db['db'], host=mongouri)
else:
mdb = mongoengine.connect(mongo_db['db'], host=mongo_db['host'])
except mongoengine.connection.ConnectionError, ex:
logging.critical(_('Unable to connect to mongodb to save log, '
'please check MONGODB_LOG settings. '
'error: {0}').format(str(ex)))
except mongoengine.connection.ConnectionError:
logging.exception(_('Unable to connect to mongodb to save log, '
'please check MONGODB_LOG settings.'))

if course_id is None:
# Require staff if not going to specific course
Expand Down
2 changes: 1 addition & 1 deletion lms/envs/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
MODULESTORE = AUTH_TOKENS.get('MODULESTORE', MODULESTORE)
CONTENTSTORE = AUTH_TOKENS.get('CONTENTSTORE', CONTENTSTORE)
DOC_STORE_CONFIG = AUTH_TOKENS.get('DOC_STORE_CONFIG',DOC_STORE_CONFIG)
MONGODB_LOG = AUTH_TOKENS.get('MONGODB_LOG')
MONGODB_LOG = AUTH_TOKENS.get('MONGODB_LOG', {})

OPEN_ENDED_GRADING_INTERFACE = AUTH_TOKENS.get('OPEN_ENDED_GRADING_INTERFACE',
OPEN_ENDED_GRADING_INTERFACE)
Expand Down