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

[FEATURE REQUEST] Add a way to filter by minion_id in jobs.list_jobs #60182

Open
Lesvek opened this issue May 13, 2021 · 1 comment
Open

[FEATURE REQUEST] Add a way to filter by minion_id in jobs.list_jobs #60182

Lesvek opened this issue May 13, 2021 · 1 comment
Assignees
Labels
Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged
Milestone

Comments

@Lesvek
Copy link

Lesvek commented May 13, 2021

Is your feature request related to a problem? Please describe.
When we want to investigate a problem on a minion, one of the first thing to do is to check if something changed that could cause the problem. To do that, we could use he jobs.list_jobs function.
The problem is that, when we use a grain or a pillar as a filter, there is no way to filter using the minion id:

admin@dev-master:~$ salt -G os:ubuntu grains.get os
dev-master:
    Ubuntu
dev-consul:
    Ubuntu
admin@dev-master:~$ sudo salt-run jobs.list_jobs search_target='dev-master' search_function='grains.get'

To get the information we want, we need to know the exact target that was used to call the function:

admin@dev-master:~$ salt -G os:ubuntu grains.get os
dev-master:
    Ubuntu
dev-consul:
    Ubuntu
admin@dev-master:~$ sudo salt-run jobs.list_jobs search_function='grains.get' search_target='os:ubuntu'
20210513171425970846:
    ----------
    Arguments:
        - os
    Function:
        grains.get
    StartTime:
        2021, May 13 17:14:25.970846
    Target:
        os:ubuntu
    Target-type:
        grain
    User:
        admin

On our infrastructure, we have a lot of use-cases that require using different targets to deploy or changes (progressive deployment, apply changes only on minion providing certain services, etc).

Describe the solution you'd like

Add a way to list jobs using the minion_id:

admin@dev-master:~$ sudo salt-run jobs.list_jobs search_function='grains.get' search_minion_target='dev-master'
20210513171425970846:
    ----------
    Arguments:
        - os
    Function:
        grains.get
    Minion-target:
        - dev-consul
        - dev-master
    StartTime:
        2021, May 13 17:14:25.970846
    Target:
        os:ubuntu
    Target-type:
        grain
    User:
        admin

Describe alternatives you've considered

We could index the minion output to an elasticsearch cluster and use that to search the changes instead. One of the difficulty would be to parse the output and adapt it so it can be easily indexed.

There is already an elasticsearch returner but it looks a bit dated and the json output module would need to be adapted.

Additional context

Please Note

@Lesvek Lesvek added Feature new functionality including changes to functionality and code refactors, etc. needs-triage labels May 13, 2021
@garethgreenaway garethgreenaway added this to the Blocked milestone May 27, 2021
@garethgreenaway garethgreenaway added Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged and removed Feature new functionality including changes to functionality and code refactors, etc. needs-triage labels May 27, 2021
@Lesvek
Copy link
Author

Lesvek commented Jun 2, 2021

I'm under the impression that there is a bug that prevents the minion list from being updated when using the default returner.

Could this be the case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged
Projects
None yet
Development

No branches or pull requests

2 participants