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

WIP: Add back some auto-configuration so we can use from edx-platform. #51

Closed
wants to merge 1 commit into from

Conversation

nedbat
Copy link
Contributor

@nedbat nedbat commented Jan 9, 2017

No description provided.

@nedbat
Copy link
Contributor Author

nedbat commented Jan 9, 2017

@jcdyer @cpennington

@nedbat
Copy link
Contributor Author

nedbat commented Jan 9, 2017

I don't like that there are three places that say "bin/python". Some of this could go away if we drop the CODEJAIL_TEST_VENV environment variable. It isn't documented in the readme, and I managed the same effect by activating the edx-platform venv before running the codejail tests.

@nedbat nedbat changed the title Add back some auto-configuration so we can use from edx-platform. WIP: Add back some auto-configuration so we can use from edx-platform. Jan 9, 2017
@nedbat
Copy link
Contributor Author

nedbat commented Jan 9, 2017

I'm not done with this, but it'd be good to get some eyeballs on it early :)

venv = sibling_sandbox_venv()
if not venv:
raise Exception("Couldn't find sandbox virtualenv")
configure("python", os.path.join(venv, "bin/python"), user="sandbox", lang=languages.python2)
Copy link

Choose a reason for hiding this comment

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

I don't think this is the right place to add this logic. edx-platform should be deciding where it wants its sandboxes created, not codejail.

Copy link

Choose a reason for hiding this comment

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

At the most, codejail should provide an option to autocreate a sibling env, but the importing code should have to opt in to it, perhaps by an environment variable, or some other setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would love for you to help figure out how to do that. Keep in mind that the tests need pass, both with and with sandboxes in the environment. We have Django middleware that configures codejail, but that middleware isn't run during the safe_exec tests, since they are not in a Django app.

@@ -101,16 +95,26 @@ def not_safe_exec(
globals_dict.update(json_safe(g_dict))


if ALWAYS_BE_UNSAFE: # pragma: no cover
# Make safe_exec actually call not_safe_exec, but log that we're doing so.
def configure_python():
Copy link

Choose a reason for hiding this comment

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

Thanks! Let me know when this is ready for a for-real review.

* Python 2.x is called "python" again

* Provide "configure_python" so that edx-platform can get convenient
  configuration.
@nedbat
Copy link
Contributor Author

nedbat commented Jan 10, 2017

@jcdyer ready for real review.

@jcdyer
Copy link

jcdyer commented Apr 2, 2019

Closing for lack of action. Feel free to reopen if needed.

@jcdyer jcdyer closed this Apr 2, 2019
@feanil feanil deleted the ned/xenial branch October 18, 2019 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants