Skip to content

Feature: Set TaskParams i.e limit from an ExtractValue of an Integration #2914

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

Closed
MIJohnson opened this issue Apr 13, 2025 · 2 comments
Closed
Labels

Comments

@MIJohnson
Copy link
Contributor

Related to

Web-Backend (APIs)

Impact

nice to have

Missing Feature

Currently there is no way to limit (i.e --limit) the host/group that an task is executed for when the task triggered from an Integration, ideally based on a parameter from the integration request (ie ExtractValue)

This means that, currently, if you want to achieve this, you would have to create a separate Ansible Task for every Host/Group, and also a separate corresponding integration, this can cause quite a lot of unnecessary duplication when you have lots of customers to run separately.

Implementation

Add a controlled list qualifier to specify whether an extract value is for Environment or TaskParams, and populate the Task object accordingly.

Design

A new additional parameter VariableType could be added to IntegrationExtractValue to differentiate whether a value is intended for Environment or for TaskParams

type IntegrationVariableType string

const (
	IntegrationVariableEnvironment   IntegrationVariableType = "environment"
	IntegrationVariableTaskParam 	 IntegrationVariableType = "task"
)

type IntegrationExtractValue struct {
	ID            int                           `db:"id" json:"id" backup:"-"`
	IntegrationID int                           `db:"integration_id" json:"integration_id" backup:"-"`
	Name          string                        `db:"name" json:"name"`
	ValueSource   IntegrationExtractValueSource `db:"value_source" json:"value_source"`
	BodyDataType  IntegrationBodyDataType       `db:"body_data_type" json:"body_data_type"`
	Key           string                        `db:"key" json:"key"`
	Variable      string                        `db:"variable" json:"variable"`
	VariableType  IntegrationVariableType       `db:"variable_type" json:"variable_type"`
}

in the RunIntegration function we could separate the extraction of values into the corresponding Environment and TaskParams objects and pass them both into the Task creation so that limit (and other task variables) could be controlled.

@MIJohnson
Copy link
Contributor Author

MIJohnson commented Apr 14, 2025

Please let me know if you are willing to consider a pull request for a working version of the above functionality.

@MIJohnson
Copy link
Contributor Author

Pull request opened for this feature: #2918

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant