Drop patches merged upstream

0001-Do-not-use-pooled-ActiveMQ-connections.patch
0001-PDB-3993-Don-t-lookup-namespaces-to-compute-cli-subc.patch
honeysql-0.7-compat.patch

Git-Dch: Full
parent 30fda742
From cc32ca9c24649dee15b7ba9ee7971849368f0cb5 Mon Sep 17 00:00:00 2001
From: Apollon Oikonomopoulos <apoikos@debian.org>
Date: Fri, 17 Feb 2017 15:44:08 +0200
Subject: [PATCH] Do not use pooled ActiveMQ connections
ActiveMQ-pool is not available in Debian. Since the ActiveMQ-based queue
is deprecated anyway, just revert to the plain simple connection
factory.
---
src/puppetlabs/puppetdb/amq_migration.clj | 3 +--
src/puppetlabs/puppetdb/mq.clj | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
--- a/src/puppetlabs/puppetdb/amq_migration.clj
+++ b/src/puppetlabs/puppetdb/amq_migration.clj
@@ -14,7 +14,6 @@
[java.io File ByteArrayInputStream]
[org.apache.activemq.broker BrokerService]
[org.apache.activemq.usage SystemUsage MemoryUsage]
- [org.apache.activemq.pool PooledConnectionFactory]
[org.apache.activemq ActiveMQConnectionFactory ScheduledMessage])
(:require [clojure.tools.logging :as log]
[clojure.java.io :as io]
@@ -340,7 +339,7 @@
e)))))
(defn activemq-connection-factory [spec]
- (proxy [PooledConnectionFactory java.lang.AutoCloseable]
+ (proxy [ActiveMQConnectionFactory java.lang.AutoCloseable]
[(ActiveMQConnectionFactory. spec)]
(close [] (.stop this))))
--- a/src/puppetlabs/puppetdb/mq.clj
+++ b/src/puppetlabs/puppetdb/mq.clj
@@ -3,8 +3,7 @@
[org.apache.activemq ScheduledMessage]
[org.apache.activemq.usage SystemUsage MemoryUsage]
[javax.jms Connection Message TextMessage BytesMessage Session]
- [org.apache.activemq ActiveMQConnectionFactory]
- [org.apache.activemq.pool PooledConnectionFactory])
+ [org.apache.activemq ActiveMQConnectionFactory])
(:require [clojure.java.jmx :as jmx]
[clojure.tools.logging :as log]
[puppetlabs.puppetdb.utils :as utils]
@@ -205,6 +204,6 @@
{ScheduledMessage/AMQ_SCHEDULED_DELAY (str (long millis))}))
(defn activemq-connection-factory [spec]
- (proxy [PooledConnectionFactory java.lang.AutoCloseable]
+ (proxy [ActiveMQConnectionFactory java.lang.AutoCloseable]
[(ActiveMQConnectionFactory. spec)]
(close [] (.stop this))))
From 5573db0ae5faec3741451f9ed8811f9a03c7973a Mon Sep 17 00:00:00 2001
From: Rob Browning <rlb@puppet.com>
Date: Fri, 10 Aug 2018 11:43:06 -0500
Subject: [PATCH] (PDB-3993) Don't lookup namespaces to compute cli subcommand
list
Simplify subcommand dispatching to make future changes easier, given
that we haven't needed the dynamic lookup yet.
---
src/puppetlabs/puppetdb/cli/benchmark.clj | 2 -
src/puppetlabs/puppetdb/cli/services.clj | 1 -
src/puppetlabs/puppetdb/cli/version.clj | 2 -
src/puppetlabs/puppetdb/core.clj | 113 +++++++---------------
4 files changed, 36 insertions(+), 82 deletions(-)
--- a/src/puppetlabs/puppetdb/cli/benchmark.clj
+++ b/src/puppetlabs/puppetdb/cli/benchmark.clj
@@ -65,8 +65,6 @@
[java.nio.file Files OpenOption]
[java.util ArrayDeque]))
-(def cli-description "Development-only benchmarking tool")
-
(defn try-load-file
"Attempt to read and parse the JSON in `file`. If this failed, an error is
logged, and nil is returned."
--- a/src/puppetlabs/puppetdb/cli/services.clj
+++ b/src/puppetlabs/puppetdb/cli/services.clj
@@ -82,7 +82,6 @@
[java.util.concurrent.locks ReentrantLock]
[org.joda.time Period]))
-(def cli-description "Main PuppetDB daemon")
(def database-metrics-registry (get-in metrics/metrics-registries [:database :registry]))
;; ## Wiring
--- a/src/puppetlabs/puppetdb/cli/version.clj
+++ b/src/puppetlabs/puppetdb/cli/version.clj
@@ -12,8 +12,6 @@
(:require [puppetlabs.puppetdb.meta.version :refer [version]]
[puppetlabs.puppetdb.scf.migrate :refer [desired-schema-version]]))
-(def cli-description "Print info about the current version of PuppetDB")
-
;; TODO: Would like to add database info and some other things here, but that
;; will require us to have access to the configuration info. At present, the
;; configuration parsing code is scattered throughout services.clj and not
--- a/src/puppetlabs/puppetdb/core.clj
+++ b/src/puppetlabs/puppetdb/core.clj
@@ -1,90 +1,43 @@
(ns puppetlabs.puppetdb.core
- "CLI invokation
-
- This is a tiny shim that delegates the command-line arguments to an
- appropriate handler.
-
- If the user executes the program with arguments like so:
-
- ./this-program foo arg1 arg2 arg3
-
- ...then we'll look for a namespace called
- `puppetlabs.puppetdb.cli.foo` and invoke its `-main` method with
- `[arg1 arg2 arg3]`."
- (:require [puppetlabs.trapperkeeper.logging :as logging-utils]
- [clojure.tools.namespace :as ns]
- [puppetlabs.puppetdb.utils :as utils]
- [clojure.string :as str]))
-
-(def ns-prefix "puppetlabs.puppetdb.cli.")
-
-(defn cli-namespaces
- "Return a set of namespaces underneath the .cli parent"
- []
- {:post [(set? %)]}
- (set (for [namespace (ns/find-namespaces-on-classpath)
- :let [ns-str (name namespace)]
- :when (.startsWith ns-str ns-prefix)]
- namespace)))
-
-(defn var-from-ns
- "Resolve a var, by name, from a (potentially un-required)
- namespace. If no matching var is found, returns nil.
-
- Example:
-
- (var-from-ns \"clojure.string\" \"split\")"
- [ns v]
- {:pre [(string? ns)
- (string? v)]}
- (require (symbol ns))
- (if-let [var (resolve (symbol ns v))]
- (var-get var)))
-
-(defn available-subcommands
- "Return the set of available subcommands for this application"
- []
- {:post [(set? %)]}
- (set (for [namespace (cli-namespaces)
- :let [ns-str (name namespace)
- subcmd (last (str/split ns-str #"\."))]]
- subcmd)))
+ "Handles command line arguments."
+ (:require
+ [clojure.string :as str]
+ [puppetlabs.puppetdb.cli.services :as svcs]
+ [puppetlabs.puppetdb.cli.version :as cver]
+ [puppetlabs.puppetdb.utils :as utils]
+ [puppetlabs.trapperkeeper.logging :as logging-utils]))
+
+(def usage-lines
+ ["Available subcommands:"
+ " version Display version information"
+ " services Run PuppetDB"
+ "For help on a given subcommand, invoke it with -h"])
(defn usage
- "Display help text to the user"
- []
- (let [cmds (sort (for [cmd (available-subcommands)]
- [cmd (var-from-ns (str ns-prefix cmd) "cli-description")]))]
- (println "Available subcommands:\n")
- (doseq [[subcommand description] cmds]
- (println subcommand "\t" (or description "")))
- (println "\nFor help on a given subcommand, invoke it with -h")))
+ [stream]
+ (binding [*out* stream]
+ (println (str/join "\n" usage-lines))))
(defn run-command
"Does the real work of invoking a command by attempting to result it and
passing in args. `success-fn` is a no-arg function that is called when the
command successfully executes. `fail-fn` is called when a bad command is given
or a failure executing a command."
- [success-fn fail-fn args]
- (let [subcommand (first args)
- allowed? (available-subcommands)]
-
+ [success-fn fail-fn [subcommand & args]]
+ (let [run (case subcommand
+ "version" #(apply cver/-main args)
+ "services" #(apply svcs/-main args)
+ (do
+ ;; FIXME: this should be *err*
+ (usage *out*)
+ (fail-fn)))]
(utils/fail-unsupported-jdk fail-fn)
-
- ;; Bad invokation
- (when-not (allowed? subcommand)
- (usage)
- (fail-fn))
-
- (let [module (str ns-prefix subcommand)
- args (rest args)]
- (try
- (require (symbol module))
- (apply (resolve (symbol module "-main")) args)
- (success-fn)
- (catch Throwable e
- (logging-utils/catch-all-logger e)
- (fail-fn))))))
+ (try
+ (run)
+ (success-fn)
+ (catch Throwable e
+ (logging-utils/catch-all-logger e)
+ (fail-fn)))))
(defn -main
[& args]
Author: Apollon Oikonomopoulos <apoikos@debian.org>
Description: Compatibility with honeysql >= 0.7.0
honeysql commit 3ec65bd[1] changed behavior in that number literals are
converted to parameters to handle things like NaN etc. PuppetDB's query engine
does not expect the base queries to be parameterized and fails with
.
org.postgresql.util.PSQLException: No value specified for parameter 1
.
This affects all fact-related endpoints. Work our way around this by passing
fp.depth=0 as raw SQL.
.
[1] https://github.com/jkk/honeysql/commit/3ec65bd1980299cf8aca2897a456594d35c218a1
Last-Update: 2017-08-07
Forwarded: no
--- a/src/puppetlabs/puppetdb/query_eng/engine.clj
+++ b/src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -165,7 +165,7 @@
[:value_types :vt]
[:= :vt.id :f.value_type_id]]
:where [:and
- [:= :fp.depth 0]
+ [:= :fp.depth (hcore/raw "0")]
[:= :f.factset_id :fs.id]]}
:facts_data]]}}
"trusted" {:type :queryable-json
@@ -177,7 +177,7 @@
[:value_types :vt]
[:= :vt.id :f.value_type_id]]
:where [:and
- [:= :fp.depth 0]
+ [:= :fp.depth (hcore/raw "0")]
[:= :f.factset_id :fs.id]
[:= :fp.name (hcore/raw "'trusted'")]]}}}
@@ -312,7 +312,7 @@
[:value_types :vt]
[:= :f.value_type_id :vt.id]]
:modifiers [:distinct]
- :where [:!= :f.value_type_id 5]}
+ :where [:!= :f.value_type_id (hcore/raw "5")]}
:relationships {;; Children - direct
"facts" {:columns ["name"]}
@@ -384,7 +384,7 @@
[:= :vt.id :f.value_type_id]]
:left-join [[:environments :env]
[:= :fs.environment_id :env.id]]
- :where [:= :fp.depth 0]}
+ :where [:= :fp.depth (hcore/raw "0")]}
:relationships (merge certname-relations
{"environments" {:local-columns ["environment"]
@@ -443,7 +443,7 @@
[:= :f.value_type_id :vt.id]]
:left-join [[:environments :env]
[:= :fs.environment_id :env.id]]
- :where [:!= :vt.id 5]}
+ :where [:!= :vt.id (hcore/raw "5")]}
:relationships (merge certname-relations
{"facts" {:columns ["certname" "name"]}
@@ -1022,7 +1022,7 @@
[:value_types :vt]
[:= :vt.id :f.value_type_id]]
:where [:and
- [:= :depth 0]
+ [:= :depth (hcore/raw "0")]
[:= :f.factset_id :factsets.id]]}
:t]]}
:facts_data]]}}
0001-Do-not-use-pooled-ActiveMQ-connections.patch
compojure-1.6-compat.patch
disable-update-checks.patch
honeysql-0.7-compat.patch
0001-PDB-3993-Don-t-lookup-namespaces-to-compute-cli-subc.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment