diff --git a/acceptance/suites/pre_suite/foss/80_configure_puppet.rb b/acceptance/suites/pre_suite/foss/80_configure_puppet.rb index 8526b910c..b82e8e604 100644 --- a/acceptance/suites/pre_suite/foss/80_configure_puppet.rb +++ b/acceptance/suites/pre_suite/foss/80_configure_puppet.rb @@ -15,8 +15,7 @@ end end - config = { 'certificate-authority' => { 'allow-subject-alt-names' => true }, - 'dropsonde' => { 'enabled' => false }} + config = { 'certificate-authority' => { 'allow-subject-alt-names' => true } } path = '/etc/puppetlabs/puppetserver/conf.d/puppetserver.conf' modify_tk_config(master, path, config) end diff --git a/dev/bootstrap.cfg b/dev/bootstrap.cfg index d90c63e8e..237ebedc0 100644 --- a/dev/bootstrap.cfg +++ b/dev/bootstrap.cfg @@ -14,7 +14,6 @@ puppetlabs.trapperkeeper.services.status.status-service/status-service puppetlabs.trapperkeeper.services.metrics.metrics-service/metrics-service puppetlabs.trapperkeeper.services.metrics.metrics-service/metrics-webservice puppetlabs.services.jruby.jruby-metrics-service/jruby-metrics-service -puppetlabs.services.analytics.analytics-service/analytics-service puppetlabs.trapperkeeper.services.watcher.filesystem-watch-service/filesystem-watch-service # To enable the CA service, leave the following line uncommented diff --git a/dev/puppetserver.conf b/dev/puppetserver.conf index a6f6d0ed1..abd7b7733 100644 --- a/dev/puppetserver.conf +++ b/dev/puppetserver.conf @@ -8,10 +8,6 @@ product: { artifact-id: puppetserver} } -dropsonde: { - enabled: false -} - webserver: { access-log-config: ./dev/request-logging-dev.xml client-auth: want diff --git a/ext/thread_test/bootstrap.cfg b/ext/thread_test/bootstrap.cfg index bfffc6433..63b77e4b7 100644 --- a/ext/thread_test/bootstrap.cfg +++ b/ext/thread_test/bootstrap.cfg @@ -15,7 +15,6 @@ puppetlabs.trapperkeeper.services.status.status-service/status-service puppetlabs.trapperkeeper.services.metrics.metrics-service/metrics-service puppetlabs.trapperkeeper.services.metrics.metrics-service/metrics-webservice puppetlabs.services.jruby.jruby-metrics-service/jruby-metrics-service -puppetlabs.services.analytics.analytics-service/analytics-service puppetlabs.trapperkeeper.services.watcher.filesystem-watch-service/filesystem-watch-service # To enable the CA service, leave the following line uncommented diff --git a/ezbake/system-config/services.d/bootstrap.cfg b/ezbake/system-config/services.d/bootstrap.cfg index b0257039c..e32149cb5 100644 --- a/ezbake/system-config/services.d/bootstrap.cfg +++ b/ezbake/system-config/services.d/bootstrap.cfg @@ -14,4 +14,3 @@ puppetlabs.trapperkeeper.services.status.status-service/status-service puppetlabs.trapperkeeper.services.metrics.metrics-service/metrics-service puppetlabs.trapperkeeper.services.metrics.metrics-service/metrics-webservice puppetlabs.services.jruby.jruby-metrics-service/jruby-metrics-service -puppetlabs.services.analytics.analytics-service/analytics-service diff --git a/project.clj b/project.clj index a895a32b9..49a4d81e2 100644 --- a/project.clj +++ b/project.clj @@ -230,7 +230,6 @@ puppetlabs.puppetserver.cli.ruby puppetlabs.puppetserver.cli.irb puppetlabs.puppetserver.cli.gem - puppetlabs.services.analytics.analytics-service puppetlabs.services.protocols.legacy-routes]} :ci {:plugins [[lein-pprint "1.1.1"] [lein-exec "0.3.7"]]}} diff --git a/resources/ext/build-scripts/dropsonde-gem.txt b/resources/ext/build-scripts/dropsonde-gem.txt deleted file mode 100644 index 59c7e040c..000000000 --- a/resources/ext/build-scripts/dropsonde-gem.txt +++ /dev/null @@ -1,2 +0,0 @@ -dropsonde 0.0.8 -scanf 1.0.0 diff --git a/resources/ext/build-scripts/install-vendored-gems.sh b/resources/ext/build-scripts/install-vendored-gems.sh index f1c0f63c3..dec56eca3 100755 --- a/resources/ext/build-scripts/install-vendored-gems.sh +++ b/resources/ext/build-scripts/install-vendored-gems.sh @@ -56,13 +56,3 @@ cat "${DIR}/mri-gem-list-no-dependencies.txt" echo "jruby-puppet: { gem-home: ${DESTDIR}/opt/puppetlabs/puppet/lib/ruby/vendor_gems }" > jruby.conf install_gems "${DIR}/mri-gem-list-no-dependencies.txt" "--ignore-dependencies" - -# We need to install Dropsonde into an isolated directory so that its dependencies -# can be installed with it without relying on the gems otherwise shipped by -# puppet-agent or by puppetserver. -echo "Installing Dropsonde into an isolated directory, to prevent dependency conflicts" -cat "${DIR}/dropsonde-gem.txt" - -echo "jruby-puppet: { gem-home: ${DESTDIR}/opt/puppetlabs/server/data/puppetserver/dropsonde }" > jruby.conf - -install_gems "${DIR}/dropsonde-gem.txt" diff --git a/resources/ext/cli/dropsonde.erb b/resources/ext/cli/dropsonde.erb deleted file mode 100644 index fe35c1552..000000000 --- a/resources/ext/cli/dropsonde.erb +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -PUPPET_AGENT_RUBY="/opt/puppetlabs/puppet/bin/ruby" -DROPSONDE_DIR="/opt/puppetlabs/server/data/puppetserver/dropsonde" -DROPSONDE_BIN="${DROPSONDE_DIR}/bin/dropsonde" - -export GEM_HOME=${DROPSONDE_DIR} -export GEM_PATH=${DROPSONDE_DIR} - -if [[ -f "$DROPSONDE_BIN" && -x "$DROPSONDE_BIN" ]] -then - $PUPPET_AGENT_RUBY $DROPSONDE_BIN "$@" -else - echo "Dropsonde does not appear to be installed properly." -fi - diff --git a/resources/ext/config/conf.d/puppetserver.conf b/resources/ext/config/conf.d/puppetserver.conf index 8c3646c3e..c5f71351c 100644 --- a/resources/ext/config/conf.d/puppetserver.conf +++ b/resources/ext/config/conf.d/puppetserver.conf @@ -72,12 +72,3 @@ profiler: { # enable or disable profiling for the Ruby code; defaults to 'true'. #enabled: true } - -# settings related to submitting module metrics via Dropsonde -dropsonde: { - # enabled: true - - # How long, in seconds, to wait between dropsonde submissions - # Defaults to one week. - # interval: 604800 -} diff --git a/src/clj/puppetlabs/services/analytics/analytics_service.clj b/src/clj/puppetlabs/services/analytics/analytics_service.clj deleted file mode 100644 index 441206293..000000000 --- a/src/clj/puppetlabs/services/analytics/analytics_service.clj +++ /dev/null @@ -1,65 +0,0 @@ -(ns puppetlabs.services.analytics.analytics-service - (:require [clojure.tools.logging :as log] - [puppetlabs.trapperkeeper.core :refer [defservice]] - [puppetlabs.i18n.core :as i18n] - [puppetlabs.dujour.version-check :as version-check] - [puppetlabs.services.analytics.dropsonde :refer [run-dropsonde]])) - -(defprotocol AnalyticsService - "Protocol placeholder for the analytics service.") - -(def analytics-service-job-group-id - :analytics-service-job-group) - -(defn safe-run-dropsonde - "Prevent exceptions from escaping as this is run in a scheduled task" - [config] - (try - (log/debug (i18n/trs "Running dropsonde")) - (run-dropsonde config) - (log/debug (i18n/trs "dropsonde run complete")) - (catch Exception _ - (log/info (i18n/trs "Failed while running dropsonde"))))) - -(defservice analytics-service - AnalyticsService - [[:PuppetServerConfigService get-config] - [:SchedulerService interspaced stop-jobs]] - - (start - [this context] - (let [config (get-config)] - ;; Configure analytics - (let [product-name (or (get-in config [:product :name]) - {:group-id "puppetlabs" - :artifact-id "puppetserver"}) - checkin-interval-millis (* 1000 60 60 24) ; once per day - update-server-url (get-in config [:product :update-server-url]) - check-for-updates (get-in config [:product :check-for-updates] true)] - (if check-for-updates - (interspaced checkin-interval-millis - (fn [] - (try - (version-check/check-for-update - {:product-name product-name} update-server-url) - (catch Exception _ - (log/error (i18n/trs "Failed to check for product updates"))))) - analytics-service-job-group-id) - (log/info (i18n/trs "Not checking for updates - opt-out setting exists")))) - (log/info (i18n/trs "Puppet Server Update Service has successfully started and will run in the background")) - - ;; Configure dropsonde, enabled by default if not specified - (let [dropsonde-enabled (get-in config [:dropsonde :enabled] true) - ;; once a week, config value is documented as seconds - dropsonde-interval-millis (* 1000 (get-in config [:dropsonde :interval] - (* 60 60 24 7)))] - (if dropsonde-enabled - (interspaced dropsonde-interval-millis #(safe-run-dropsonde config) analytics-service-job-group-id) - (log/info (i18n/trs (str "Not submitting module metrics via Dropsonde -- submission is disabled. " - "Enable this feature by setting `dropsonde.enabled` to true in Puppet Server''s config.")))))) - context) - - (stop [this context] - (log/info (i18n/trs "Puppet Server Update Service shutting down")) - (stop-jobs analytics-service-job-group-id) - context)) diff --git a/src/clj/puppetlabs/services/analytics/dropsonde.clj b/src/clj/puppetlabs/services/analytics/dropsonde.clj deleted file mode 100644 index 53301d0f0..000000000 --- a/src/clj/puppetlabs/services/analytics/dropsonde.clj +++ /dev/null @@ -1,34 +0,0 @@ -(ns puppetlabs.services.analytics.dropsonde - (:require [clojure.tools.logging :as log] - [puppetlabs.i18n.core :as i18n] - [puppetlabs.puppetserver.shell-utils :as shell-utils] - [puppetlabs.services.jruby.jruby-puppet-core :as jruby-puppet])) - -(def puppet-agent-ruby "/opt/puppetlabs/puppet/bin/ruby") -(def dropsonde-dir "/opt/puppetlabs/server/data/puppetserver/dropsonde") -(def dropsonde-bin (str dropsonde-dir "/bin/dropsonde")) - -(defn run-dropsonde - [config] - ;; process config to ensure default resolution of these settings - (let [puppet-config (jruby-puppet/initialize-puppet-config - {} - (jruby-puppet/extract-puppet-config (:jruby-puppet config)) - false) - confdir (:server-conf-dir puppet-config) - codedir (:server-code-dir puppet-config) - vardir (:server-var-dir puppet-config) - logdir (:server-log-dir puppet-config) - result (shell-utils/execute-command puppet-agent-ruby - {:args [dropsonde-bin "submit"] - :env {"GEM_HOME" dropsonde-dir - "GEM_PATH" dropsonde-dir - "HOME" dropsonde-dir - "PUPPET_CONFDIR" confdir - "PUPPET_CODEDIR" codedir - "PUPPET_VARDIR" vardir - "PUPPET_LOGDIR" logdir}})] - (if (= 0 (:exit-code result)) - (log/info (i18n/trs "Successfully submitted module metrics via Dropsonde.")) - (log/warn (i18n/trs "Failed to submit module metrics via Dropsonde. Error: {0}" - (:stderr result)))))) diff --git a/test/integration/puppetlabs/services/analytics/analytics_service_test.clj b/test/integration/puppetlabs/services/analytics/analytics_service_test.clj deleted file mode 100644 index f6b00c921..000000000 --- a/test/integration/puppetlabs/services/analytics/analytics_service_test.clj +++ /dev/null @@ -1,67 +0,0 @@ -(ns puppetlabs.services.analytics.analytics-service-test - (:require - [clojure.test :refer [deftest is testing]] - [puppetlabs.dujour.version-check :as version-check] - [puppetlabs.puppetserver.bootstrap-testutils :as bootstrap-testutils] - [puppetlabs.trapperkeeper.testutils.logging :as logutils])) - -(deftest ^:integration version-check-test - (testing "master calls into the dujour version check library using the correct values" - ; This promise will store the parameters passed to the version-check-test-fn, which allows us to keep the - ; assertions about their values inside the version-check-test and will also ensure failures will appear if - ; the master stops calling the check-for-updates! function - (let [version-check-params (promise) - version-check-test-fn (fn [request-values update-server-url] - (deliver version-check-params - {:request-values request-values - :update-server-url update-server-url}))] - (with-redefs - [version-check/check-for-update version-check-test-fn] - (logutils/with-test-logging - (bootstrap-testutils/with-puppetserver-running-with-mock-jrubies - "Mocking is safe here because we're not doing anything with JRubies, just making sure - the service starts and makes the right dujour calls" - app - {:jruby-puppet {:max-active-instances 1} - :webserver {:port 8081} - :product {:update-server-url "http://notarealurl/" - :name {:group-id "puppets" - :artifact-id "yoda"}}} - (let [params-received (deref version-check-params 30000 - {:request-values - {:product-name - :no-product-name-received-before-time-out-reached} - :update-server-url - :no-update-server-url-received-before-time-out-reached})] - (is (= {:group-id "puppets" :artifact-id "yoda"} - (get-in params-received [:request-values :product-name]))) - (is (= "http://notarealurl/" - (:update-server-url params-received))))))))) - - (testing "master does not make an analytics call to dujour if opt-out exists" - ; This promise will store the parameters passed to the version-check-test-fn, which allows us to keep the - ; assertions about their values inside the version-check-test and will also ensure failures will appear if - ; the master stops calling the check-for-updates! function - (let [version-check-params (promise) - version-check-test-fn (fn [request-values update-server-url] - (deliver version-check-params - {:request-values request-values - :update-server-url update-server-url}))] - (with-redefs - [version-check/check-for-updates! version-check-test-fn] - (logutils/with-test-logging - (bootstrap-testutils/with-puppetserver-running-with-mock-jrubies - "Mocking is safe here because we're not doing anything with JRubies, just making sure - the service starts and makes the right dujour calls" - app - {:jruby-puppet {:max-active-instances 1} - :webserver {:port 8081} - :product {:update-server-url "http://notarealurl/" - :name {:group-id "puppets" - :artifact-id "yoda"} - :check-for-updates false}} - (is (logutils/logged? - #"Not checking for updates - opt-out setting exists" :info)) - (let [params-received (deref version-check-params 100 - :no-params-received-before-time-out-reached)] - (is (= :no-params-received-before-time-out-reached params-received)))))))))