Variable in AST query?

8 views
Skip to first unread message

Valayil Abraham

unread,
Apr 24, 2019, 4:57:12 PM4/24/19
to Puppet Users
I would like to pass a variable into an AST query in my powershell script. eg. in the query below I would like to use $role instead of "avrt". Is it possible? Getting an error when I tired it.

$trusted_facts = @{
  query = '["from", "facts",
  ["and",
    ["=", "name", "trusted"],
    ["subquery", "facts",
      ["and",
        ["subquery", "fact_contents",
          ["and",
            ["~>", "path", ["trusted", "extensions", "pp_role"]],
            ["=", "value", "avrt"]
          ]
        ],
        ["subquery", "fact_contents",
          ["and",
            ["~>", "path", ["trusted", "extensions", "pp_apptier"]],
            ["=", "value", "production"]
          ]
        ]
      ]
    ]
  ]
]'
}
Reply all
Reply to author
Forward
0 new messages