Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds two new Ansible modules to the ngine_io.cloudstack collection—extension and custom_action—to manage CloudStack Extensions and their Custom Actions, along with new integration test targets and action-group registration.
Changes:
- Added
plugins/modules/extension.pyto manage CloudStack extensions, including registration/unregistration with resources. - Added
plugins/modules/custom_action.pyto manage custom actions belonging to an extension. - Added integration test targets for both modules and registered them in
meta/runtime.ymlaction groups.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/targets/extension/tasks/main.yml | New integration playbook covering extension create/update/details/state/idempotence flows. |
| tests/integration/targets/extension/meta/main.yml | Adds cs_common dependency for the extension integration target. |
| tests/integration/targets/extension/aliases | Registers the extension integration target in cloud/cs and cs/group1. |
| tests/integration/targets/custom_action/tasks/main.yml | New integration playbook covering custom_action lifecycle, parameters/details, and idempotence. |
| tests/integration/targets/custom_action/meta/main.yml | Adds cs_common dependency for the custom_action integration target. |
| tests/integration/targets/custom_action/aliases | Registers the custom_action integration target in cloud/cs and cs/group1. |
| plugins/modules/extension.py | New module implementing CloudStack extension present/absent and register/unregister operations. |
| plugins/modules/custom_action.py | New module implementing custom action present/absent operations and normalization/diffing. |
| meta/runtime.yml | Adds custom_action and extension to the CloudStack action group list. |
Suppressed comments (1)
plugins/modules/custom_action.py:490
- absent_custom_action() currently fails if the referenced extension does not exist (via get_extension_id()->fail_json), but the integration test expects removing a custom action from an unknown extension to be a no-op (not changed).
def absent_custom_action(self):
custom_action = self.get_custom_action()
if custom_action:
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
resmo
force-pushed
the
feature/extension
branch
from
August 24, 2026 10:29
6cad8e3 to
6e40b61
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
plugins/modules/custom_action.py:291
get_custom_action()should handle the case whereget_extension_id()returnsNone(e.g.,state=absentwith a missing extension) and returnNoneinstead of callinglistCustomActionswith an invalidextensionid.
def get_custom_action(self):
args = {
"extensionid": self.get_extension_id(),
"name": self.module.params.get("name"),
}
custom_actions = self.query_api("listCustomActions", **args)
if custom_actions:
# The name filter of listCustomActions matches exactly.
self.custom_action = custom_actions["extensioncustomaction"][0]
return self.custom_action
Comment on lines
+260
to
+262
| def __init__(self, module): | ||
| super(AnsibleCloudStackCustomAction, self).__init__(module) | ||
| self.returns = { |
Comment on lines
+275
to
+280
| def get_extension_id(self): | ||
| name = self.module.params.get("extension") | ||
| extensions = self.query_api("listExtensions", name=name) | ||
| if not extensions: | ||
| self.fail_json(msg="Extension %s not found" % name) | ||
| return extensions["extension"][0]["id"] |
Comment on lines
+259
to
+270
| - name: test register resource in check mode | ||
| ngine_io.cloudstack.extension: | ||
| name: "{{ cs_resource_prefix }}-ext" | ||
| resource_id: "{{ cs_resource_prefix }}-cluster" | ||
| resource_type: Cluster | ||
| state: register | ||
| register: extension | ||
| check_mode: true | ||
| - name: verify test register resource in check mode | ||
| assert: | ||
| that: | ||
| - extension is changed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.