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

How to exclude puppet noop in query ? #212

Open
Victor-D opened this issue Jun 23, 2021 · 1 comment
Open

How to exclude puppet noop in query ? #212

Victor-D opened this issue Jun 23, 2021 · 1 comment
Labels

Comments

@Victor-D
Copy link

Victor-D commented Jun 23, 2021

Hello guys

I retrieve a puppet environment inventory using pypuppetdb and i'm looking for a way to exclude puppet entries where noop was enabled.

My python code is something like that to retrieve only the puppet environment name :

        query = AndOperator()

        fact_query = OrOperator()
        fact_query.add(EqualsOperator('name', fact))

        query.add(fact_query)

        return self.db.facts(query=query)

and I tried things like this but I get a 400 Bad Request :

        query = AndOperator()
        fact_query = OrOperator()
        fact_query.add(EqualsOperator('name', fact))
        query.add(fact_query)

        status_query = OrOperator()
        arg_query = AndOperator()
        arg_query.add(EqualsOperator('noop_pending', False))
        arg_query.add(EqualsOperator('noop', False))
        status_query.add(arg_query)
        query.add(status_query)

        return self.db.facts(query=query)

Maybe /facts is not the right way to retrieve all hosts current puppet environment name.

Thanks for your help
Victor

@Victor-D Victor-D changed the title How to exclude puppet noop in query How to exclude puppet noop in query ? Jun 23, 2021
@Victor-D
Copy link
Author

up

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

2 participants