From b29caf55119a34881ce2eb655c7f37c875fc49ee Mon Sep 17 00:00:00 2001 From: "Sean P. McDonald" Date: Wed, 25 Sep 2024 12:30:02 -0500 Subject: [PATCH] (PE-39250) Remove project APIs and configuration Removes access to file_metadata and compile options which allowed fetching data and compiling for bolt projects. This commit does not remove all project based code, it is restricted to covering enough ground to remove access to any functionality, but there may still be some internal code left over. --- .../services/jruby/jruby_puppet_service.clj | 4 +- .../legacy_routes/legacy_routes_service.clj | 3 - .../services/master/master_core.clj | 71 ++------ .../services/master/master_service.clj | 7 - .../services/protocols/jruby_puppet.clj | 2 +- .../puppetlabs/puppetserver/JRubyPuppet.java | 2 +- .../puppetserver-lib/puppet/server/master.rb | 7 +- .../services/master/master_service_test.clj | 152 ------------------ .../services/master/master_core_test.clj | 34 +--- 9 files changed, 25 insertions(+), 257 deletions(-) diff --git a/src/clj/puppetlabs/services/jruby/jruby_puppet_service.clj b/src/clj/puppetlabs/services/jruby/jruby_puppet_service.clj index 2c7d87850..e00760569 100644 --- a/src/clj/puppetlabs/services/jruby/jruby_puppet_service.clj +++ b/src/clj/puppetlabs/services/jruby/jruby_puppet_service.clj @@ -84,8 +84,8 @@ (.compileCatalog jruby-instance request-options)) (compile-ast - [this jruby-instance compile-options boltlib-path] - (.compileAST jruby-instance compile-options boltlib-path)) + [this jruby-instance compile-options] + (.compileAST jruby-instance compile-options)) (get-environment-module-info [this jruby-instance env-name] diff --git a/src/clj/puppetlabs/services/legacy_routes/legacy_routes_service.clj b/src/clj/puppetlabs/services/legacy_routes/legacy_routes_service.clj index 270cffaf5..c535e063f 100644 --- a/src/clj/puppetlabs/services/legacy_routes/legacy_routes_service.clj +++ b/src/clj/puppetlabs/services/legacy_routes/legacy_routes_service.clj @@ -43,9 +43,6 @@ (i18n/trs "Versioned code not supported.")))) (constantly nil) false - nil - nil - nil (get-in config [:puppetserver :certname]))) master-route-handler (comidi/routes->handler master-routes) master-mount (master-core/get-master-mount diff --git a/src/clj/puppetlabs/services/master/master_core.clj b/src/clj/puppetlabs/services/master/master_core.clj index 5dfea3ae6..298940666 100644 --- a/src/clj/puppetlabs/services/master/master_core.clj +++ b/src/clj/puppetlabs/services/master/master_core.clj @@ -981,44 +981,29 @@ (schema/defn ^:always-validate compile-fn :- IFn [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) - current-code-id-fn :- IFn - boltlib-path :- (schema/maybe [schema/Str]) - bolt-projects-dir :- (schema/maybe schema/Str)] + current-code-id-fn :- IFn] (fn [request] (let [request-options (-> request :body slurp (validated-body CompileRequest)) - versioned-project (get request-options "versioned_project") environment (get request-options "environment")] - ;; Check to ensure environment/versioned_project are mutually exlusive and - ;; at least one of them is set. - (cond - (and versioned-project environment) - {:status 400 - :headers {"Content-Type" "text/plain"} - :body (i18n/tru "A compile request cannot specify both `environment` and `versioned_project` parameters.")} - - (and (nil? versioned-project) (nil? environment)) + ;; Check to ensure environment is set. + + (if (nil? environment) {:status 400 :headers {"Content-Type" "text/plain"} :body (i18n/tru "A compile request must include an `environment` or `versioned_project` parameter.")} - :else - (let [compile-options (if versioned-project - ;; we need to parse some data from the project config for project compiles - (parse-project-compile-data request-options versioned-project bolt-projects-dir) - ;; environment compiles only need to set the code ID - (assoc request-options + (let [compile-options (assoc request-options "code_id" - (current-code-id-fn environment)))] + (current-code-id-fn environment))] {:status 200 :headers {"Content-Type" "application/json"} :body (json/encode (jruby-protocol/compile-ast jruby-service (:jruby-instance request) - compile-options - boltlib-path))}))))) + compile-options))}))))) (schema/defn ^:always-validate v4-catalog-handler :- IFn @@ -1034,10 +1019,8 @@ compile-handler :- IFn [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn - current-code-id-fn :- IFn - boltlib-path :- (schema/maybe [schema/Str]) - bolt-projects-dir :- (schema/maybe schema/Str)] - (-> (compile-fn jruby-service current-code-id-fn boltlib-path bolt-projects-dir) + current-code-id-fn :- IFn] + (-> (compile-fn jruby-service current-code-id-fn) (jruby-request/wrap-with-jruby-instance jruby-service) wrap-with-jruby-queue-limit jruby-request/wrap-with-error-handling)) @@ -1061,17 +1044,14 @@ v3-ruby-routes :- bidi-schema/RoutePair "v3 route tree for the ruby side of the master service." [request-handler :- IFn - bolt-builtin-content-dir :- (schema/maybe [schema/Str]) - bolt-projects-dir :- (schema/maybe schema/Str) certname :- schema/Str] (comidi/routes (comidi/GET ["/node/" [#".*" :rest]] request (request-handler request)) (comidi/GET ["/file_content/" [#".*" :rest]] request - ;; Not strictly ruby routes anymore because of this - (file-serving/file-content-handler bolt-builtin-content-dir bolt-projects-dir request-handler (ring/params-request request))) + (request-handler request)) (comidi/GET ["/file_metadatas/" [#".*" :rest]] request - (file-serving/file-metadatas-handler bolt-builtin-content-dir bolt-projects-dir request-handler (ring/params-request request))) + (request-handler request)) (comidi/GET ["/file_metadata/" [#".*" :rest]] request (request-handler request)) (comidi/GET ["/file_bucket_file/" [#".*" :rest]] request @@ -1100,9 +1080,7 @@ get-code-content-fn :- IFn current-code-id-fn :- IFn cache-enabled :- schema/Bool - wrap-with-jruby-queue-limit :- IFn - boltlib-path :- (schema/maybe [schema/Str]) - bolt-projects-dir :- (schema/maybe schema/Str)] + wrap-with-jruby-queue-limit :- IFn] (let [class-handler (create-cacheable-info-handler-with-middleware (fn [jruby env] (some-> jruby-service @@ -1136,9 +1114,7 @@ compile-handler' (compile-handler jruby-service wrap-with-jruby-queue-limit - current-code-id-fn - boltlib-path - bolt-projects-dir)] + current-code-id-fn)] (comidi/routes (comidi/POST "/compile" request (compile-handler' request)) @@ -1189,20 +1165,15 @@ current-code-id-fn :- IFn environment-class-cache-enabled :- schema/Bool wrap-with-jruby-queue-limit :- IFn - boltlib-path :- (schema/maybe [schema/Str]) - bolt-builtin-content-dir :- (schema/maybe [schema/Str]) - bolt-projects-dir :- (schema/maybe schema/Str) certname :- schema/Str] (comidi/context "/v3" - (v3-ruby-routes ruby-request-handler bolt-builtin-content-dir bolt-projects-dir certname) + (v3-ruby-routes ruby-request-handler certname) (comidi/wrap-routes (v3-clojure-routes jruby-service get-code-content-fn current-code-id-fn environment-class-cache-enabled - wrap-with-jruby-queue-limit - boltlib-path - bolt-projects-dir) + wrap-with-jruby-queue-limit) clojure-request-wrapper))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1304,9 +1275,6 @@ get-code-content-fn :- IFn current-code-id-fn :- IFn environment-class-cache-enabled :- schema/Bool - boltlib-path :- (schema/maybe [schema/Str]) - bolt-builtin-content-dir :- (schema/maybe [schema/Str]) - bolt-projects-dir :- (schema/maybe schema/Str) certname :- schema/Str] (comidi/routes (v3-routes ruby-request-handler @@ -1316,9 +1284,6 @@ current-code-id-fn environment-class-cache-enabled wrap-with-jruby-queue-limit - boltlib-path - bolt-builtin-content-dir - bolt-projects-dir certname) (v4-routes clojure-request-wrapper jruby-service @@ -1380,9 +1345,6 @@ wrap-with-authorization-check :- IFn wrap-with-jruby-queue-limit :- IFn environment-class-cache-enabled :- schema/Bool - boltlib-path :- (schema/maybe [schema/Str]) - bolt-builtin-content-dir :- (schema/maybe [schema/Str]) - bolt-projects-dir :- (schema/maybe schema/Str) certname :- schema/Str] (let [ruby-request-handler (wrap-middleware handle-request wrap-with-authorization-check @@ -1399,9 +1361,6 @@ get-code-content current-code-id environment-class-cache-enabled - boltlib-path - bolt-builtin-content-dir - bolt-projects-dir certname))) (def MasterStatusV1 diff --git a/src/clj/puppetlabs/services/master/master_service.clj b/src/clj/puppetlabs/services/master/master_service.clj index 1c332f100..cab08e49c 100644 --- a/src/clj/puppetlabs/services/master/master_service.clj +++ b/src/clj/puppetlabs/services/master/master_service.clj @@ -115,8 +115,6 @@ certname (get-in config [:puppetserver :certname]) localcacert (get-in config [:puppetserver :localcacert]) puppet-version (get-in config [:puppetserver :puppet-version]) - bolt-builtin-content-dir (get-in config [:bolt :builtin-content-dir] []) - bolt-projects-dir (get-in config [:bolt :projects-dir]) max-queued-requests (get-in config [:jruby-puppet :max-queued-requests] 0) max-retry-delay (get-in config [:jruby-puppet :max-retry-delay] 1800) settings (ca/config->master-settings config) @@ -135,8 +133,6 @@ max-queued-requests max-retry-delay)) identity) - - boltlib-path (get-in config [:jruby-puppet :boltlib-path]) ring-app (comidi/routes (master-core/construct-root-routes puppet-version jruby-service @@ -146,9 +142,6 @@ (get-auth-handler) wrap-with-jruby-queue-limit environment-class-cache-enabled - boltlib-path - bolt-builtin-content-dir - bolt-projects-dir certname)) routes (comidi/context path ring-app) route-metadata (comidi/route-metadata routes) diff --git a/src/clj/puppetlabs/services/protocols/jruby_puppet.clj b/src/clj/puppetlabs/services/protocols/jruby_puppet.clj index fdad88472..afd4497c0 100644 --- a/src/clj/puppetlabs/services/protocols/jruby_puppet.clj +++ b/src/clj/puppetlabs/services/protocols/jruby_puppet.clj @@ -89,7 +89,7 @@ "Compile the catalog for a given certname") (compile-ast - [this jruby-instance compile-options boltlib-path] + [this jruby-instance compile-options] "Compiles arbitrary Puppet ASTs into mini catalogs") (get-environment-module-info diff --git a/src/java/com/puppetlabs/puppetserver/JRubyPuppet.java b/src/java/com/puppetlabs/puppetserver/JRubyPuppet.java index 192e90ba8..76136f795 100644 --- a/src/java/com/puppetlabs/puppetserver/JRubyPuppet.java +++ b/src/java/com/puppetlabs/puppetserver/JRubyPuppet.java @@ -24,7 +24,7 @@ public interface JRubyPuppet { List getTransportInfoForEnvironment(String environment); List getModuleInfoForEnvironment(String environment); Map compileCatalog(Map requestBody); - Map compileAST(Map compileOptions, List boltlibPath); + Map compileAST(Map compileOptions); Map getModuleInfoForAllEnvironments(); JRubyPuppetResponse handleRequest(Map request); Object getSetting(String setting); diff --git a/src/ruby/puppetserver-lib/puppet/server/master.rb b/src/ruby/puppetserver-lib/puppet/server/master.rb index 9414b7ae9..0333d4e22 100644 --- a/src/ruby/puppetserver-lib/puppet/server/master.rb +++ b/src/ruby/puppetserver-lib/puppet/server/master.rb @@ -114,10 +114,9 @@ def compileCatalog(request_data) end end - def compileAST(compile_options, boltlib_path) + def compileAST(compile_options) ruby_compile_options = convert_java_args_to_ruby(compile_options) - ruby_boltlib_path = boltlib_path.kind_of?(Java::JavaUtil::List) ? boltlib_path.to_a : nil - Puppet::Server::ASTCompiler.compile(ruby_compile_options, ruby_boltlib_path) + Puppet::Server::ASTCompiler.compile(ruby_compile_options, nil) end def create_recorder @@ -248,7 +247,7 @@ def check_cadir_for_deprecation_warning # Each array element is examined, if it is expected to be a map # we call back to the convert_java_args_to_ruby method, if it # is expected to be an array, we recurse otherwise we do not modify - # the value. + # the value. def resolve_java_objects_from_list(list) list.map do |value| if value.kind_of?(Java::ClojureLang::IPersistentMap) diff --git a/test/integration/puppetlabs/services/master/master_service_test.clj b/test/integration/puppetlabs/services/master/master_service_test.clj index 257e9c1c9..b45f50ce1 100644 --- a/test/integration/puppetlabs/services/master/master_service_test.clj +++ b/test/integration/puppetlabs/services/master/master_service_test.clj @@ -770,155 +770,3 @@ Integer/parseInt)] (is (= 503 status-code)) (is (<= 0 retry-after 1800)))))))) - -(deftest ^:integration project-file-content - (bootstrap-testutils/with-puppetserver-running - app - {:bolt {:builtin-content-dir ["./dev-resources/puppetlabs/services/master/master_core_test/builtin_bolt_content"] - :projects-dir "./dev-resources/puppetlabs/services/master/master_core_test/bolt_projects"} - :jruby-puppet {:gem-path gem-path - :max-active-instances 1 - :server-code-dir test-resources-code-dir - :server-conf-dir master-service-test-runtime-dir}} - - (testing "can retrieve file_content from the modules mount from a project" - (let [response (http-get "/puppet/v3/file_content/modules/utilities/etc/greeting?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= "Good morning\n" (:body response))) - (is (= "13" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - ;; this also tests that we can retrieve file content from the .modules mount of the project - ;; since that is where this task is located - (testing "can retrieve file_content from the tasks mount from a project" - (let [response (http-get "/puppet/v3/file_content/tasks/utilities/blah?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= "bye" (:body response))) - (is (= "3" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve file_content from the top level of a project" - (let [response (http-get "/puppet/v3/file_content/tasks/local/init.sh?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= ". $PT__installdir/helpers/files/marco.sh\nmarco\n" (:body response))) - (is (= "63" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve file_content from a project with an embedded structure" - (let [response (http-get "/puppet/v3/file_content/modules/test/packages?versioned_project=embedded_e19e09")] - (is (= 200 (:status response))) - (is (= "vim" (:body response))) - (is (= "3" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve file_content from a custom modulepath" - (let [response (http-get "/puppet/v3/file_content/modules/helpers/marco.sh?versioned_project=local_afafaf")] - (is (= 200 (:status response))) - (is (= "marco () {\n echo \"polo\"\n}\n" (:body response))) - (is (= "27" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve built-in file_content" - (let [response (http-get "/puppet/v3/file_content/tasks/bic_module_one/init.sh?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= ". $PT__installdir/helpers/files/marco.sh\nmarco\n" (:body response))) - (is (= "63" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve overriden built-in file_content" - (let [response (http-get "/puppet/v3/file_content/tasks/bic_module_one/init.sh?versioned_project=override_builtin_content")] - (is (= 200 (:status response))) - (is (= ". $PT__installdir/helpers/files/marco.sh\noverride_marco\n" (:body response))) - (is (= "73" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "cannot retrieve file_content from the default modulepath when a custom modulepath is set" - (let [response (http-get "/puppet/v3/file_content/tasks/utilities/blah?versioned_project=local_afafaf")] - (is (= 404 (:status response))))) - - (testing "mount point not found" - (let [response (http-get "/puppet/v3/file_content/glorb/test/packages?versioned_project=local_23")] - (is (= 404 (:status response))))) - - (testing "project not found" - (let [response (http-get "/puppet/v3/file_content/modules/test/packages?versioned_project=nothere")] - (is (= 404 (:status response))))) - - (testing "module not found" - (let [response (http-get "/puppet/v3/file_content/modules/nomodule/packages?versioned_project=embedded_e19e09")] - (is (= 404 (:status response))))) - - (testing "missing path?" - (let [response (http-get "/puppet/v3/file_content/modules/test/?versioned_project=embedded_e19e09")] - (is (= 404 (:status response))))) - - (testing "can retrieve plugin metadata" - (let [response (http-get "/puppet/v3/file_metadatas/plugins?versioned_project=local_23") - [file-entry] (filter #(= "puppet/monkey_patch.rb" (get % "relative_path")) (json/decode (:body response)))] - ;; Only check some of the entries that won't vary based on the test environment - (is (= nil (get file-entry "destination"))) - (is (= "file" (get file-entry "type"))) - (is (= "sha256" (get-in file-entry ["checksum" "type"]))) - (is (= "{sha256}76b2e03b82880885385595045033c4e3122e373c7023e037461a650ec85829ad" (get-in file-entry ["checksum" "value"]))) - ;; Does it choose from the right module? - (is (str/ends-with? (get file-entry "path") "modules/helpers/lib")))) - - (testing "can retrieve builtin plugin metadata" - (let [response (http-get "/puppet/v3/file_metadatas/plugins?versioned_project=local_23") - [file-entry] (filter #(= "puppet/builtin_monkey_patch.rb" (get % "relative_path")) (json/decode (:body response)))] - ;; Only check some of the entries that won't vary based on the test environment - (is (= nil (get file-entry "destination"))) - (is (= "file" (get file-entry "type"))) - (is (= "sha256" (get-in file-entry ["checksum" "type"]))) - (is (= "{sha256}76b2e03b82880885385595045033c4e3122e373c7023e037461a650ec85829ad" (get-in file-entry ["checksum" "value"]))) - ;; Does it choose from the right module? - (is (str/ends-with? (get file-entry "path") "bic_module_one/lib")))) - - (testing "can retrieve plugin files" - (let [response (http-get "/puppet/v3/file_content/plugins/puppet/monkey_patch.rb?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= "class NilClass\n def empty?\n true\n end\nend\n" (:body response))) - (is (= "59" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve builtin plugin files" - (let [response (http-get "/puppet/v3/file_content/plugins/puppet/builtin_monkey_patch.rb?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= "class NilClass\n def empty?\n true\n end\nend\n" (:body response))) - (is (= "59" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve overridden builtin plugin files" - (let [response (http-get "/puppet/v3/file_content/plugins/puppet/builtin_monkey_patch.rb?versioned_project=override_builtin_content")] - (is (= 200 (:status response))) - (is (= "overridden_class NilClass\n def empty?\n true\n end\nend\n" (:body response))) - (is (= "70" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve plugin files from the top level project lib dir" - (let [response (http-get "/puppet/v3/file_content/plugins/puppet/comment.rb?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= "# This is the project\n" (:body response))) - (is (= "22" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "can retrieve pluginfacts metadata" - (let [response (http-get "/puppet/v3/file_metadatas/pluginfacts?versioned_project=local_23") - [file-entry] (filter #(= "something" (get % "relative_path")) (json/decode (:body response)))] - (is (= nil (get file-entry "destination"))) - (is (= "file" (get file-entry "type"))) - (is (= "sha256" (get-in file-entry ["checksum" "type"]))) - (is (= "{sha256}4bc453b53cb3d914b45f4b250294236adba2c0e09ff6f03793949e7e39fd4cc1" (get-in file-entry ["checksum" "value"]))))) - - (testing "can retrieve pluginfacts files" - (let [response (http-get "/puppet/v3/file_content/pluginfacts/unhelpful?versioned_project=local_23")] - (is (= 200 (:status response))) - (is (= "factually unhelpful\n" (:body response))) - (is (= "20" (get-in response [:headers "content-length"]))) - (is (= "application/octet-stream" (get-in response [:headers "content-type"]))))) - - (testing "doesn't support nonstandard options" - (let [response (http-get "/puppet/v3/file_metadatas/plugins?versioned_project=local_23&links=manage")] - (is (= 400 (:status response))) - (is (= "Not all parameter values are supported in this implementation: \nThe only supported value of `links` at this time is `follow`" - (:body response))))))) diff --git a/test/unit/puppetlabs/services/master/master_core_test.clj b/test/unit/puppetlabs/services/master/master_core_test.clj index 9386820c0..037c8c80c 100644 --- a/test/unit/puppetlabs/services/master/master_core_test.clj +++ b/test/unit/puppetlabs/services/master/master_core_test.clj @@ -49,9 +49,6 @@ (fn [___] (throw (IllegalStateException. "Versioned code not supported."))) (constantly nil) true - nil - ["./dev-resources/puppetlabs/services/master/master_core_test/builtin_bolt_content"] - "./dev-resources/puppetlabs/services/master/master_core_test/bolt_projects" "test-certname") (comidi/routes->handler) (wrap-middleware identity puppet-version))) @@ -433,7 +430,7 @@ :gem-path "bar:foobar" :ruby-load-path ["foo"]}))) (compile-catalog [_ _ _] {:cool "catalog"}) - (compile-ast [_ _ _ _] {:cool "catalog"})) + (compile-ast [_ _ _] {:cool "catalog"})) handler (fn ([req] {:request req})) app (build-ring-handler handler "1.2.3" jruby-service)] (testing "compile endpoint for environments" @@ -447,36 +444,11 @@ :trusted_facts {:values {}} :variables {:values {}}}))))] (is (= 200 (:status response))))) - (testing "compile endpoint for projects" + (testing "compile endpoint fails with no environment" (let [response (app (-> {:request-method :post :uri "/v3/compile" :content-type "application/json"} (ring-mock/body (json/encode {:certname "foo" - :versioned_project "fake_project" - :code_ast "{\"__pcore_something\": \"Foo\"}" - :facts {:values {}} - :trusted_facts {:values {}} - :variables {:values {}} - :options {:compile_for_plan true}}))))] - (is (= 200 (:status response))))) - (testing "compile endpoint fails with no environment or versioned_project" - (let [response (app (-> {:request-method :post - :uri "/v3/compile" - :content-type "application/json"} - (ring-mock/body (json/encode {:certname "foo" - :code_ast "{\"__pcore_something\": \"Foo\"}" - :facts {:values {}} - :trusted_facts {:values {}} - :variables {:values {}} - :options {:compile_for_plan true}}))))] - (is (= 400 (:status response))))) - (testing "compile endpoint fails with both environment and versioned_project" - (let [response (app (-> {:request-method :post - :uri "/v3/compile" - :content-type "application/json"} - (ring-mock/body (json/encode {:certname "foo" - :environment "production" - :versioned_project "fake_project" :code_ast "{\"__pcore_something\": \"Foo\"}" :facts {:values {}} :trusted_facts {:values {}} @@ -507,7 +479,7 @@ :gem-path "bar:foobar" :ruby-load-path ["foo"]}))) (compile-catalog [_ _ _] {:cool "catalog"}) - (compile-ast [_ _ _ _] {:cool "catalog"})) + (compile-ast [_ _ _] {:cool "catalog"})) handler (fn ([req] {:request req})) app (build-ring-handler handler "1.2.3" jruby-service)] (testing "catalog endpoint succeeds"