Repository navigation
Setup: keep the default plugin agent beside contributed agents - #12239
mjansenDatabay wants to merge 1 commit into
Conversation
chfsx
left a comment
There was a problem hiding this comment.
Thanks for picking this up, a contributed agent that implements ILIAS\Setup\Agent directly silently losing installation, update and activation is a real trap.
I'd like to suggest narrowing the change, though, because in its current form it changes the CLI surface of every plugin that already ships an agent, and this targets release_10.
Many existing plugin agents already extend ilPluginDefaultAgent and call parent::getInstallObjective() / parent::getUpdateObjective(), e.g. Hub2, OpenCast, PhotoGallery and SrExternalPageContent. Admittedly, these are all ours, so the sample is a bit biased ;-) But I'd be surprised if we were the only ones who worked around it this way, so there are probably more out there. For those, the extra default agent does not change what is executed, since ilComponentInstallPluginObjective, ilComponentUpdatePluginObjective, ilComponentActivatePluginsObjective and ilPluginLanguageUpdatedObjective hash on class and plugin name and are deduplicated by the ObjectiveIterator. But because a single contributed agent is no longer returned directly and is always wrapped in an AgentCollection, every path below the plugin gets one more level:
- named objectives:
OpenCast.OpencastRBACRightsbecomesOpenCast.ilOpenCastAgent.OpencastRBACRights - migrations:
PhotoGallery.ilObjPhotoGalleryMigrationbecomesPhotoGallery.ilObjPhotoGallerySetupAgent.ilObjPhotoGalleryMigration - status metrics are stored under a different path
- agents with
hasConfig()now expect their config under<plugin>.<agent class>instead of<plugin>
Calls of achieve and migrate --run in existing documentation, runbooks and deployment scripts would break with a patch release. In addition, the agent class name is used as collection key, so a namespaced agent would end up as something like Plugin.Vendor\Plugin\Setup\Agent.objective on the command line.
Proposal:
- Only add the default agent if none of the contributed agents is an
ilPluginDefaultAgent. An agent extending it already provides installation, update and activation. - If only one agent remains, return it directly as before, so existing paths stay stable.
- Use the short class name as collection key.
- Adjust the docblock and the README accordingly: the default agent is added unless the plugin's agent already extends
ilPluginDefaultAgent.
This still fixes the case of an agent implementing Agent directly (it then gets the default agent beside it), without affecting plugins that already handle it themselves.
69cfa43 to
3ad978d
Compare
A plugin setup agent replaced installation, update and activation. The default agent is added unless a contributed agent already extends it. Co-authored-by: chfsx <fs@studer-raimann.ch>
3ad978d to
1388d14
Compare
A plugin setup agent replaced installation, update and activation. Contributed agents are now collected in addition to the default agent.