1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
From: Apollon Oikonomopoulos <apoikos@debian.org>
Date: Thu, 30 Jun 2022 11:21:19 -0400
Subject: Disable update checks by default
Don't let PDB call home by default. Note that setting 'disable-update-checking'
to 'false' is not enough; it only disables PDB's internal periodic update
checker, but the dashboard triggers an on-demand check with a call to
/pdb/meta/v1/version/latest.
Last-Update: 2022-06-30
Forwarded: not-needed
---
src/puppetlabs/puppetdb/config.clj | 7 ++++++-
src/puppetlabs/puppetdb/meta.clj | 2 +-
test/puppetlabs/puppetdb/config_test.clj | 4 ++--
3 files changed, 9 insertions(+), 4 deletions(-)
Index: puppetdb/src/puppetlabs/puppetdb/config.clj
===================================================================
--- puppetdb.orig/src/puppetlabs/puppetdb/config.clj
+++ puppetdb/src/puppetlabs/puppetdb/config.clj
@@ -204,7 +204,7 @@
(all-optional
{:certificate-whitelist s/Str
:certificate-allowlist s/Str
- :disable-update-checking (pls/defaulted-maybe String "false")
+ :disable-update-checking (pls/defaulted-maybe String "true")
:add-agent-report-filter (pls/defaulted-maybe String "true")
:log-queries (pls/defaulted-maybe String "false")
:query-timeout-default (pls/defaulted-maybe String "600")
@@ -705,6 +705,11 @@
(defn pe? [config]
(= "pe-puppetdb" (get-in config [:global :product-name])))
+(defn update-checking-disabled? [config]
+ (or
+ (pe? config)
+ (get-in config [:puppetdb :disable-update-checking])))
+
(defn update-server [config]
(get-in config [:global :update-server]))
Index: puppetdb/src/puppetlabs/puppetdb/meta.clj
===================================================================
--- puppetdb.orig/src/puppetlabs/puppetdb/meta.clj
+++ puppetdb/src/puppetlabs/puppetdb/meta.clj
@@ -36,7 +36,7 @@
;; If we get one of these requests from pe-puppetdb, we always want to
;; return 'newer->false' so that the dashboard will never try
;; to display info about a newer version being available.
- (if (conf/pe? config)
+ (if (conf/update-checking-disabled? config)
(http/json-response {:newer false
:version (v/version)
:link nil})
Index: puppetdb/test/puppetlabs/puppetdb/config_test.clj
===================================================================
--- puppetdb.orig/test/puppetlabs/puppetdb/config_test.clj
+++ puppetdb/test/puppetlabs/puppetdb/config_test.clj
@@ -52,9 +52,9 @@
(is (thrown? clojure.lang.ExceptionInfo
(configure-puppetdb {:puppetdb {:add-agent-report-filter 1337}}))))
- (testing "disable-update-checking should default to 'false' if left unspecified"
+ (testing "disable-update-checking should default to 'true' if left unspecified"
(let [config (configure-puppetdb {})]
- (is (= (get-in config [:puppetdb :disable-update-checking]) false))))
+ (is (= (get-in config [:puppetdb :disable-update-checking]) true))))
(testing "shold default :log-queries to false"
(let [config (configure-puppetdb {})]
|