Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old SCORMs stopped working after upgrading to 18.0.0 #76

Closed
igobranco opened this issue Jun 20, 2024 · 6 comments
Closed

Old SCORMs stopped working after upgrading to 18.0.0 #76

igobranco opened this issue Jun 20, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@igobranco
Copy link

After upgrading to 18.0.0 we no longer view the old deploy SCORMs.
We are using an on-premisses S3 compatible (Ceph) service and not the AWS service.

The change of:

fix: use usage_key instead of block_id as location identifier for scorm data by @Danyal-Faheem in #71

As inadvertently created this issue, from my analysis it seams because the storage.exists(...) isn't working as expected on our deployment. I don't know if it could affecting other deployments using AWS S3 service.

From the Django documentation:

exists(name)[source]
Returns True if a file referenced by the given name already exists in the storage system, or False if the name is available for a new file.

It's written in the docs a file and not a folder. It could work fine from local file storage, but at least on S3 Ceph isn't - storage class: storages.backends.s3boto3.S3Boto3Storage.

Ref: https://docs.djangoproject.com/en/3.2/ref/files/storage/#django.core.files.storage.Storage.exists

Proposal change, that would fix our issue:

     @property
     def extract_folder_base_path(self):
         """
         Path to the folder where packages will be extracted.
         Compute hash of the unique block usage_id and use that as our directory name.
         """
         # For backwards compatibility, we return the old path if the directory exists
-        if self.storage.exists(self.extract_old_folder_base_path):
+        if self.storage.exists(os.path.join(self.extract_old_folder_base_path, self.package_meta["sha1"], self.index_page_path)):
             return self.extract_old_folder_base_path
         sha1 = hashlib.sha1()
         sha1.update(str(self.scope_ids.usage_id).encode())
         hashed_usage_id = sha1.hexdigest()
         return os.path.join(self.scorm_location(), hashed_usage_id)
@DawoudSheraz
Copy link

@Danyal-Faheem FYI

@DawoudSheraz DawoudSheraz added the bug Something isn't working label Jun 20, 2024
@pomegranited
Copy link

I'm seeing this error running latest tutor nightly:

2024-06-20 22:41:47,739 WARNING 7 [xblock.plugin] [user None] [ip None] plugin.py:144 - Unable to load XBlock 'scorm'
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.11/site-packages/xblock/plugin.py", line 141, in load_classes
    yield (class_.name, cls._load_class_entry_point(class_))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/xblock/plugin.py", line 70, in _load_class_entry_point
    class_ = entry_point.load()
             ^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2496, in load
    return self.resolve()
           ^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2502, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/openedxscorm/__init__.py", line 1, in <module>
    from .scormxblock import ScormXBlock
  File "/openedx/venv/lib/python3.11/site-packages/openedxscorm/scormxblock.py", line 18, in <module>
    import importlib_resources
ModuleNotFoundError: No module named 'importlib_resources'

@igobranco
Copy link
Author

@pomegranited to fix that on our old Open edX version installation we have installed the package importlib-resources==6.4.0 on Tutor config's OPENEDX_EXTRA_PIP_REQUIREMENTS; and double check if you are running it on python 3.8 instead of 3.11.

@Danyal-Faheem
Copy link
Contributor

Hi @igobranco, thank you for reporting this issue and for providing a solution as well. We're looking into it now.

@Danyal-Faheem
Copy link
Contributor

Hi @pomegranited, can you provide steps on how to reproduce this error as well as your specific tutor environment version?
I have tried to launch a new instance of tutor 18.0.0-nightly and scorm seems to be working fine for me.

@regisb
Copy link
Contributor

regisb commented Jun 24, 2024

This issue is resolved in v18.0.1, which ships in the (updated) "openedx" Docker image. Please fetch the latest changes with tutor images pull openedx.

(@pomegranited I believe your issue is unrelated. As far as I understand, you should simply update your nightly image.)

@regisb regisb closed this as completed Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

5 participants