Page MenuHomePhabricator

PCC throws evaluation error on valid code
Open, LowPublicBUG REPORT

Description

PCC throws an error parsing this code, from modules/cephadm/functions/ssh_keys.pp:

function cephadm::ssh_keys (
    Stdlib::Host $cephadm_controller,
) >> String[1] {
    $pql = @("PQL")
        inventory[facts.cephadm.ssh.key] {
            certname = "${cephadm_controller}"
        }
        | PQL
    wmflib::puppetdb_query($pql).reduce('') |$memo, $res| {
        "${memo}${res['facts.cephadm.ssh.key']}\n"
    }
}

Error:

Error: Evaluation Error: Error while evaluating a Function Call, 859: unexpected token at 'PQL parse error at line 1, column 34:

inventory[facts.cephadm.ssh.key] {
                                 ^

Expected one of:

]

Example non-related change, which triggered this failure, https://gerrit.wikimedia.org/r/c/operations/puppet/+/1037792

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

PCC is using PuppetDB v6 (it's a Debian Buster VM..) and it seemes like the inventory endpoint is a new feature in PuppetDB v7? I couldn't quickly find a release notes entry for it but it's not mentioned in the v6 docs at least.

good point @taavi, the inventory endpoint does seem to be supported, but in my testing dotted notation for facts is not supported via PQL.