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

fix: fix issue in modifying plugins associated with an entrypoint #641

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/dioptra/restapi/v1/entrypoints/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,11 @@ def append(
for plugin_file in plugin["plugin_files"]
]
existing_entry_point_plugin_files = [
entry_point_plugin_file
models.EntryPointPluginFile(
entry_point=new_entrypoint,
plugin=entry_point_plugin_file.plugin,
plugin_file=entry_point_plugin_file.plugin_file,
)
for entry_point_plugin_file in entrypoint.entry_point_plugin_files
if entry_point_plugin_file.plugin.resource_id not in set(plugin_ids)
]
Expand Down Expand Up @@ -779,16 +783,29 @@ def delete(
)

# create a new snapshot with the plugin removed
entrypoint_parameters = [
models.EntryPointParameter(
name=param.name,
default_value=param.default_value,
parameter_type=param.parameter_type,
parameter_number=param.parameter_number,
)
for param in entrypoint.parameters
]
new_entrypoint = models.EntryPoint(
name=entrypoint.name,
description=entrypoint.description,
task_graph=entrypoint.task_graph,
parameters=entrypoint.parameters,
parameters=entrypoint_parameters,
resource=entrypoint.resource,
creator=current_user,
)
new_entrypoint.entry_point_plugin_files = [
entry_point_plugin_file
models.EntryPointPluginFile(
entry_point=new_entrypoint,
plugin=entry_point_plugin_file.plugin,
plugin_file=entry_point_plugin_file.plugin_file,
)
for entry_point_plugin_file in entrypoint.entry_point_plugin_files
if entry_point_plugin_file.plugin.resource_id != plugin_id
]
Expand Down