Skip to content

Conversation

mbertrand
Copy link
Member

@mbertrand mbertrand commented Oct 8, 2025

What are the relevant tickets?

N/A

Description (What does it do?)

Sets the overwrite flag to False when calling ingest_canvas_course from the ContentFileWebhookView

How can this be tested?

  • Set this in your backend.local.env file:
    CANVAS_COURSE_BUCKET_NAME=ol-data-lake-landing-zone-production
    
  • In a web container shell:
    from learning_resources.models import *
    ContentFile.objects.filter(run__learning_resource__readable_id="canvas-15.060_FA24").delete()
  • In a non-container python shell:
    import requests
    import hmac
    import hashlib 
    import json
    from time import time
    data = {
      'content_path': 'canvas/course_content/28777/735a452a9b0cade0449876c4f7d4537b7b49616132d20c8b435bf1e59ab7ac1e.imscc',
      'source':'canvas',
      'timestamp':time()
    }
    payload = bytes(json.dumps(data), 'utf-8')
    secret = "please-change-this"
    computed_signature = hmac.new(secret.encode(), payload, hashlib.sha256).hexdigest()
    requests.post('http://open.odl.local:8063/webhooks/content_files/', json=data, headers={'X-MITLearn-Signature': computed_signature})
  • Check your logs, you should see a bunch of relevant activity (may be a delay of a couple minutes until the archive is downloaded)
  • Repeat the last request. This time nothing should happen.

@mbertrand mbertrand added the Needs Review An open Pull Request that is ready for review label Oct 8, 2025
@abeglova abeglova self-assigned this Oct 8, 2025
Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

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

lgtm

@mbertrand mbertrand merged commit cd79ef8 into main Oct 8, 2025
13 checks passed
@mbertrand mbertrand deleted the mb/no_overwrite branch October 8, 2025 16:51
@odlbot odlbot mentioned this pull request Oct 8, 2025
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants