<commit_before>(ns puppetlabs.services.legacy-routes.legacy-routes-service
  (:require [puppetlabs.trapperkeeper.core :as tk]
            [clojure.tools.logging :as log]
            [puppetlabs.comidi :as comidi]
            [puppetlabs.services.legacy-routes.legacy-routes-core :as legacy-routes-core]
            [puppetlabs.services.ca.certificate-authority-core :as ca-core]
            [puppetlabs.puppetserver.certificate-authority :as ca]
            [puppetlabs.services.master.master-core :as master-core]
            [puppetlabs.trapperkeeper.services :as tk-services]
            [puppetlabs.services.protocols.legacy-routes :as legacy-routes]
            [puppetlabs.services.master.master-service :as master-service]))

(tk/defservice legacy-routes-service
  [[:WebroutingService add-ring-handler get-route]
   [:RequestHandlerService handle-request]
   [:PuppetServerConfigService get-config]
   [:MasterService]
   [:CaService]]
  (init
    [this context]
    (let [path (get-route this)
          config (get-config)
          puppet-version (get-in config [:puppet-server :puppet-version])
          ca-settings (ca/config->ca-settings (get-config))
          ca-mount (get-route (tk-services/get-service this :CaService))
          master-mount (master-service/get-master-path config)
          master-handler (-> (master-core/root-routes handle-request)
                             (#(comidi/context path %))
                             comidi/routes->handler
                             (master-core/wrap-middleware puppet-version))
          ca-handler (-> (ca-core/web-routes ca-settings)
                         (#(comidi/context path %))
                         comidi/routes->handler
                         (ca-core/wrap-middleware puppet-version))
          ring-handler (legacy-routes-core/build-ring-handler
                         master-handler
                         master-mount
                         master-core/puppet-API-versions<commit_msg>(maint) Remove legacy-service dependency on Master and CA for PE<commit_after>(ns puppetlabs.services.legacy-routes.legacy-routes-service
  (:require [puppetlabs.trapperkeeper.core :as tk]
            [clojure.tools.logging :as log]
            [puppetlabs.comidi :as comidi]
            [puppetlabs.services.legacy-routes.legacy-routes-core :as legacy-routes-core]
            [puppetlabs.services.ca.certificate-authority-core :as ca-core]
            [puppetlabs.puppetserver.certificate-authority :as ca]
            [puppetlabs.services.master.master-core :as master-core]
            [puppetlabs.trapperkeeper.services :as tk-services]
            [puppetlabs.services.protocols.legacy-routes :as legacy-routes]
            [puppetlabs.services.master.master-service :as master-service]))

(tk/defservice legacy-routes-service
  [[:WebroutingService add-ring-handler get-route]
   [:RequestHandlerService handle-request]
   [:PuppetServerConfigService get-config]]
  (init
    [this context]
    (let [path (get-route this)
          config (get-config)
          puppet-version (get-in config [:puppet-server :puppet-version])
          ca-settings (ca/config->ca-settings (get-config))
          ca-mount (get-route (tk-services/get-service this :CaService))
          master-mount (master-service/get-master-path config)
          master-handler (-> (master-core/root-routes handle-request)
                             (#(comidi/context path %))
                             comidi/routes->handler
                             (master-core/wrap-middleware puppet-version))
          ca-handler (-> (ca-core/web-routes ca-settings)
                         (#(comidi/context path %))
                         comidi/routes->handler
                         (ca-core/wrap-middleware puppet-version))
          ring-handler (legacy-routes-core/build-ring-handler
                         master-handler
                         master-mount
                         master-core/puppet-API-versions
{'fraction_non_alphanumeric': 0.11194590533433509, 'fraction_numerical': 0.0, 'mean_word_length': 2.028051554207733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4670435', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1170, 'n_words': 186}