mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-12 06:07:56 +00:00
Improve plugin data deletion
This commit is contained in:
parent
5a2d6a8542
commit
fd50f3c384
@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- [Improvement] Improve plugin data deletion
|
||||||
- [Improvement] Introduce the `OPENEDX_COMMON_VERSION` setting
|
- [Improvement] Introduce the `OPENEDX_COMMON_VERSION` setting
|
||||||
- [Bugfix] Make it possible to run init jobs without starting the entire platform
|
- [Bugfix] Make it possible to run init jobs without starting the entire platform
|
||||||
- [Improvement] Reduce "openedx" Docker image size with static asset de-duplication
|
- [Improvement] Reduce "openedx" Docker image size with static asset de-duplication
|
||||||
|
@ -57,10 +57,7 @@ def disable(context, plugin_names):
|
|||||||
config = tutor_config.load_user(context.root)
|
config = tutor_config.load_user(context.root)
|
||||||
for plugin in plugin_names:
|
for plugin in plugin_names:
|
||||||
plugins.disable(config, plugin)
|
plugins.disable(config, plugin)
|
||||||
|
delete_plugin(context.root, plugin)
|
||||||
plugin_dir = tutor_env.pathjoin(context.root, "plugins", plugin)
|
|
||||||
if os.path.exists(plugin_dir):
|
|
||||||
shutil.rmtree(plugin_dir)
|
|
||||||
fmt.echo_info("Plugin {} disabled".format(plugin))
|
fmt.echo_info("Plugin {} disabled".format(plugin))
|
||||||
|
|
||||||
tutor_config.save_config_file(context.root, config)
|
tutor_config.save_config_file(context.root, config)
|
||||||
@ -69,6 +66,19 @@ def disable(context, plugin_names):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def delete_plugin(root, name):
|
||||||
|
plugin_dir = tutor_env.pathjoin(root, "plugins", name)
|
||||||
|
if os.path.exists(plugin_dir):
|
||||||
|
try:
|
||||||
|
shutil.rmtree(plugin_dir)
|
||||||
|
except PermissionError as e:
|
||||||
|
raise exceptions.TutorError(
|
||||||
|
"Could not delete file {} from plugin {} in folder {}".format(
|
||||||
|
e.filename, name, plugin_dir
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@click.command(
|
@click.command(
|
||||||
short_help="Print the location of yaml-based plugins",
|
short_help="Print the location of yaml-based plugins",
|
||||||
help="""Print the location of yaml-based plugins. This location can be manually
|
help="""Print the location of yaml-based plugins. This location can be manually
|
||||||
|
Loading…
Reference in New Issue
Block a user