question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

importcontent --fail-on-error does not capture all failures

See original GitHub issue

Observed behavior

For #9258, a --fail-on-error option was added to importcontent so that it would fail the command if there were issues importing content. However, it currently only covers a missing network file.

Errors and logs

ERROR    An error occurred during content import: File https://ourserver/content/storage/d/e/de89f92e4e6b4d79112596dde6eda776.mp4 is corrupted.

At this point, the command should fail when run with --fail-on-error, but it carried on. While looking at this code again, I noticed that the --fail-on-error was only taking effect for network 404s. It doesn’t handle files that fail checksum validation. It also doesn’t apply for importcontent disk when the source file is missing.

Expected behavior

Any exception when importing content should exit importcontent when run with --fail-on-error.

User-facing consequences

They try to use importcontent with --fail-on-error to ensure fully provisioned devices and it ignores some errors.

Steps to reproduce

Setup a source kolibri instance and make a copy of one of the objects so it can be tested with.

channel="f393c30f95fb4bec87f873b2013ec9e3"
src=$(mktemp -d)
object="${src}/content/storage/2/d/2d254f0cda03a45f27df1f1336475077.epub"
KOLIBRI_HOME="$src" python -m kolibri manage importchannel network "$channel"
KOLIBRI_HOME="$src" python -m kolibri manage importcontent network "$channel"
cp "${object}" "${object}.orig"
KOLIBRI_HOME="$src" python -m kolibri start --port 8000

Remove the object and try to import from disk in a destination kolibri instance.

rm -f "${object}"
dest=$(mktemp -d)
KOLIBRI_HOME="$dest" python -m kolibri manage importchannel disk "$channel" "$src"
KOLIBRI_HOME="$dest" python -m kolibri manage importcontent --fail-on-error disk "$channel" "$src"

An error will be logged, but the command will succeed.

Replace the object with some random characters so it’s corrupted and try to import again.

echo "foo" > "${object}"
KOLIBRI_HOME="$dest" python -m kolibri manage importcontent --fail-on-error disk "$channel" "$src"

An error will be logged, but the command will succeed.

Repeat using the network.

KOLIBRI_HOME="$dest" python -m kolibri manage importcontent --fail-on-error network --baseurl http://127.0.0.1:8000 "$channel"

An error will be logged, but the command will succeed.

Context

We’re trying to populate bootable images with Kolibri pre-seeded and we want to ensure that our build process robustly populates the desired channels.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dbnicholsoncommented, Aug 16, 2022

#9591 fixes it.

0reactions
rtibblescommented, Aug 16, 2022

Fixed in #9591

Read more comments on GitHub >

github_iconTop Results From Across the Web

Look Up Record action - ServiceNow Docs
Look up a record from any table based on defined conditions.
Read more >
ITOM Practitioner Portal - Micro Focus
In this topic, an artifact refers to a resource offering. You can import and export many of the artifacts that provide the basis...
Read more >
Release Notes - Kolibri developer documentation
Improve the importcontent --fail-on-error option in https://github.com/learningequality/kolibri/pull/ ... Redirect for Bookmarks when user is not logged in ...
Read more >
Documentum Composer User Guide
THE INFORMATION IN THIS PUBLICATION IS PROVIDED AS IS. EMC CORPORATION MAKES NO REPRESENTATIONS. OR WARRANTIES OF ANY KIND WITH RESPECT TO THE...
Read more >
Story #6134: [EPIC] Pulp import/export - Planio
Story #6137: As a user, I can import an export and have its contents be added to existing repositories to produce new repository...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found