Need help with AST Query

10 views
Skip to first unread message

Valayil Abraham

unread,
Apr 24, 2019, 4:57:12 PM4/24/19
to Puppet Users
I dont have access to the Postgres database so I have to use AST Query language and am struggling with how to get trusted facts pp_project (puppet_product) and pp_department (product) given certain values of trusteds fact pp_role (avrt) and pp_apptier (qa).

"pp_role" : "avrt",
"pp_apptier" : "qa",
"pp_project" : "puppet_product",
"pp_department" : "product"

["from", "facts",
    ["extract", ["value.extensions.pp_project"],
      ["subquery", "fact_contents",
        ["and",
          ["=", "path", ["trusted", "extensions", "pp_role"]],
          ["=", "value", "product"]
        ]
      ]
      ["subquery", "fact_contents",
        ["and",
          ["=", "path", ["trusted", "extensions", "pp_apptier"]],
          ["=", "value", "qa"]
        ]
      ]
    ]

Martin Alfke

unread,
Apr 29, 2019, 5:49:49 AM4/29/19
to puppet...@googlegroups.com
Hi Valayil,

On 23. Apr 2019, at 22:35, Valayil Abraham <abra...@gmail.com> wrote:

I dont have access to the Postgres database so I have to use AST Query language and am struggling with how to get trusted facts pp_project (puppet_product) and pp_department (product) given certain values of trusteds fact pp_role (avrt) and pp_apptier (qa).

Do you want to access the trusted extensions from within Puppet code?

$trusted[‘extensions’][‘pp_project’]

Best,
Martin


"pp_role" : "avrt",
"pp_apptier" : "qa",
"pp_project" : "puppet_product",
"pp_department" : "product"

["from", "facts",
    ["extract", ["value.extensions.pp_project"],
      ["subquery", "fact_contents",
        ["and",
          ["=", "path", ["trusted", "extensions", "pp_role"]],
          ["=", "value", "product"]
        ]
      ]
      ["subquery", "fact_contents",
        ["and",
          ["=", "path", ["trusted", "extensions", "pp_apptier"]],
          ["=", "value", "qa"]
        ]
      ]
    ]

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/7f142271-5312-4c73-832e-a650e6f598df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages