Skip to content

Commit d482ebd

Browse files
committed
(PDB-5161) engine/validate-dotted-field: drop in favor of parse-field
1 parent db62c3e commit d482ebd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/puppetlabs/puppetdb/query_eng/engine.clj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@
5454
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5555
;;; Plan - functions/transformations of the internal query plan
5656

57-
(defn validate-dotted-field
58-
[dotted-field]
59-
;; Q: why isn't parameters in here (cf. :dotted-fields below)
60-
(and (string? dotted-field) (re-find #"^(facts|trusted)\..+" dotted-field)))
61-
6257
(def field-schema (s/cond-pre s/Keyword
6358
SqlCall SqlRaw
6459
{:select s/Any s/Any s/Any}))
@@ -1866,7 +1861,14 @@
18661861
[node]
18671862
(cm/match [node]
18681863

1869-
[[(op :guard #{"=" ">" "<" "<=" ">=" "~"}) (column :guard validate-dotted-field) value]]
1864+
[[(op :guard #{"=" ">" "<" "<=" ">=" "~"})
1865+
;; Q: why isn't "parameters" included in the guard set
1866+
;; (cf. :dotted-fields below)?
1867+
(column :guard #(and (string? %)
1868+
(#{"facts" "trusted"} (-> (parse/parse-field %)
1869+
first
1870+
:name))))
1871+
value]]
18701872
;; (= :inventory (get-in (meta node) [:query-context :entity]))
18711873
(maybe-add-match-function-filter op column value)
18721874

0 commit comments

Comments
 (0)