Skip to content
This repository was archived by the owner on Aug 22, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion instance/models/mixins/openedx_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def get_storage_settings(self):
Only needed when not using ephemeral databases

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@replaceafill nit: Could you remove this comment? It doesn't apply anymore, since you've added ephemeral.yml.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pomegranited Removed. I also changed the EDXAPP_IMPORT_EXPORT_BUCKET setting to an empty string to be consistent with the change we made to the configuration repo.

"""
if self.use_ephemeral_databases:
return ''
# Workaround for broken CMS course export/import
# caused by https://github.com/edx/edx-platform/pull/14552
template = loader.get_template('instance/ansible/ephemeral.yml')
return template.render()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@replaceafill Can we make sure to revert once the upstream PR is merged? To ensure we don't forget, I would only close the current ticket once both the upstream PR is merged and this reverted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antoviaque This is actually more a fix than a workaround, and it has to be here as well as the upstream PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right - forget my comment then. Sorry for the noise.


new_settings = ''
if self.s3_access_key and self.s3_secret_access_key and self.s3_bucket_name:
Expand Down
1 change: 1 addition & 0 deletions instance/templates/instance/ansible/ephemeral.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EDXAPP_IMPORT_EXPORT_BUCKET: !!null
3 changes: 2 additions & 1 deletion instance/tests/models/test_openedx_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ def test_spawn_appserver(self, mocks, mock_provision):
getattr(appserver, field_name),
)
self.assertEqual(appserver.configuration_database_settings, "")
self.assertEqual(appserver.configuration_storage_settings, "")
ephemeral_settings = 'EDXAPP_IMPORT_EXPORT_BUCKET: !!null\n'
self.assertEqual(appserver.configuration_storage_settings, ephemeral_settings)
configuration_vars = yaml.load(appserver.configuration_settings)
self.assertEqual(configuration_vars['COMMON_HOSTNAME'], instance.domain)
self.assertEqual(configuration_vars['EDXAPP_PLATFORM_NAME'], instance.name)
Expand Down
13 changes: 12 additions & 1 deletion instance/tests/models/test_openedx_storage_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,18 @@ def test_ansible_s3_settings_ephemeral(self):
s3_bucket_name='test-s3-bucket-name',
use_ephemeral_databases=True,
)
self.assertEqual(instance.get_storage_settings(), '')
ephemeral_settings = 'EDXAPP_IMPORT_EXPORT_BUCKET: !!null\n'
self.assertEqual(instance.get_storage_settings(), ephemeral_settings)

def test_import_export_bucket_setting_ephemeral(self):
"""
Test that get_storage_settings() sets EDXAPP_IMPORT_EXPORT_BUCKET to null when in ephemeral mode
"""
instance = OpenEdXInstanceFactory(
use_ephemeral_databases=True,
)
ephemeral_settings = 'EDXAPP_IMPORT_EXPORT_BUCKET: !!null\n'
self.assertEqual(instance.get_storage_settings(), ephemeral_settings)


class SwiftContainerInstanceTestCase(TestCase):
Expand Down