pax_global_header 0000666 0000000 0000000 00000000064 14703453374 0014524 g ustar 00root root 0000000 0000000 52 comment=cfdc2654a9c724fef9320dfc3204b594d3746600
puppetlabs-puppetserver-7e1a9a8/ 0000775 0000000 0000000 00000000000 14703453374 0017066 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.clj-kondo/ 0000775 0000000 0000000 00000000000 14703453374 0021024 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.clj-kondo/config.edn 0000664 0000000 0000000 00000006571 14703453374 0022772 0 ustar 00root root 0000000 0000000 {:linters {:use {:level :error}
:unresolved-symbol {:level :warning :exclude [(clojure.test/is [thrown+? thrown+-with-msg? logged?])
(puppetlabs.puppetserver.bootstrap-testutils/with-puppetserver-running [app])
(puppetlabs.puppetserver.bootstrap-testutils/with-puppetserver-running-with-mock-jrubies [app])
(puppetlabs.puppetserver.bootstrap-testutils/with-puppetserver-running-with-config [app])
(puppetlabs.puppetserver.bootstrap-testutils/with-puppetserver-running-with-mock-jruby-puppet-fn [app])
(puppetlabs.puppetserver.bootstrap-testutils/with-puppetserver-running-with-services [app])
(puppetlabs.puppetserver.bootstrap-testutils/with-puppetserver-running-with-services-and-mock-jruby-puppet-fn [app])
(puppetlabs.puppetserver.ruby.http-client-test/with-scripting-container [sc])
(puppetlabs.services.jruby.jruby-metrics-service-test/with-metrics-test-env)
(puppetlabs.services.jruby.jruby-puppet-service/with-jruby-puppet [jruby-puppet])
(puppetlabs.services.jruby-pool-manager.jruby-core/with-jruby-instance [jruby-instance])
(puppetlabs.services.puppet-profiler.puppet-profiler-core-test/with-test-logs [logs])
(puppetlabs.trapperkeeper.core/defservice)
(puppetlabs.trapperkeeper.core/service)
(puppetlabs.trapperkeeper.services/service)
(puppetlabs.trapperkeeper.testutils.bootstrap/with-app-with-config [app])
(puppetlabs.trapperkeeper.testutils.logging/with-log-output [logs])
(puppetlabs.trapperkeeper.testutils.webserver/with-test-webserver [port])
(slingshot.slingshot/try+ [&throw-context])]}
:invalid-arity {:skip-args [puppetlabs.trapperkeeper.core/service puppetlabs.trapperkeeper.services/service]}
:refer-all {:exclude [clojure.test slingshot.test]}}
:lint-as {puppetlabs.comidi/GET compojure.core/GET
puppetlabs.comidi/PUT compojure.core/PUT
puppetlabs.comidi/POST compojure.core/POST
puppetlabs.comidi/DELETE compojure.core/DELETE
puppetlabs.comidi/PATCH compojure.core/PATCH
puppetlabs.comidi/ANY compojure.core/ANY
puppetlabs.comidi/HEAD compojure.core/HEAD
liberator.core/defresource clojure.core/defn
puppetlabs.trapperkeeper.core/defservice clojure.core/def
slingshot.slingshot/try+ clojure.core/try}
:config-in-call {puppetlabs.services.request-handler.request-handler-core/ssl-auth-info {:linters {:not-empty? {:level :off}}}}
:output {:linter-name true}}
puppetlabs-puppetserver-7e1a9a8/.clj-kondo/imports/ 0000775 0000000 0000000 00000000000 14703453374 0022521 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.clj-kondo/imports/clj-kondo/ 0000775 0000000 0000000 00000000000 14703453374 0024401 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.clj-kondo/imports/clj-kondo/slingshot/ 0000775 0000000 0000000 00000000000 14703453374 0026413 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.clj-kondo/imports/clj-kondo/slingshot/clj_kondo/ 0000775 0000000 0000000 00000000000 14703453374 0030355 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.clj-kondo/imports/clj-kondo/slingshot/clj_kondo/slingshot/ 0000775 0000000 0000000 00000000000 14703453374 0032367 5 ustar 00root root 0000000 0000000 try_plus.clj 0000664 0000000 0000000 00000003275 14703453374 0034672 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.clj-kondo/imports/clj-kondo/slingshot/clj_kondo/slingshot (ns clj-kondo.slingshot.try-plus
(:require [clj-kondo.hooks-api :as api]))
(defn expand-catch [catch-node]
(let [[catch catchee & exprs] (:children catch-node)
catchee-sexpr (api/sexpr catchee)]
(cond (vector? catchee-sexpr)
(let [[selector & exprs] exprs]
(api/list-node
[catch (api/token-node 'Exception) (api/token-node '_e#)
(api/list-node
(list* (api/token-node 'let)
(api/vector-node [selector (api/token-node nil)])
exprs))]))
:else catch-node)))
(defn try+ [{:keys [node]}]
(let [children (rest (:children node))
[body catches]
(loop [body children
body-exprs []
catches []]
(if (seq body)
(let [f (first body)
f-sexpr (api/sexpr f)]
(if (and (seq? f-sexpr) (= 'catch (first f-sexpr)))
(recur (rest body)
body-exprs
(conj catches (expand-catch f)))
(recur (rest body)
(conj body-exprs f)
catches)))
[body-exprs catches]))
new-node (api/list-node
[(api/token-node 'let)
(api/vector-node
[(api/token-node '&throw-context) (api/token-node nil)])
(api/token-node '&throw-context) ;; use throw-context to avoid warning
(with-meta (api/list-node (list* (api/token-node 'try)
(concat body catches)))
(meta node))])]
;; (prn (api/sexpr new-node))
{:node new-node}))
puppetlabs-puppetserver-7e1a9a8/.clj-kondo/imports/clj-kondo/slingshot/config.edn 0000664 0000000 0000000 00000000127 14703453374 0030350 0 ustar 00root root 0000000 0000000 {:hooks
{:analyze-call {slingshot.slingshot/try+ clj-kondo.slingshot.try-plus/try+}}}
puppetlabs-puppetserver-7e1a9a8/.dir-locals.el 0000664 0000000 0000000 00000000101 14703453374 0021507 0 ustar 00root root 0000000 0000000 ((clojure-mode . ((cider-inject-dependencies-at-jack-in . ()))))
puppetlabs-puppetserver-7e1a9a8/.dockerignore 0000664 0000000 0000000 00000000112 14703453374 0021534 0 ustar 00root root 0000000 0000000 *
!.git
!project.clj
!docker
!documentation
!ezbake
!resources
!ruby
!src
puppetlabs-puppetserver-7e1a9a8/.gitattributes 0000664 0000000 0000000 00000000620 14703453374 0021757 0 ustar 00root root 0000000 0000000 project.clj merge=version-mergeup
acceptance/config/beaker/options.rb merge=version-mergeup
documentation/release_notes.markdown merge=ours
resources/ext/build-scripts/mri-gem-list-no-deps.txt merge=ours
docker/** text eol=lf
resources/ext/build-scripts/* text eol=lf
resources/ext/cli_defaults/* text eol=lf
resources/ext/cli/* text eol=lf
puppetlabs-puppetserver-7e1a9a8/.github/ 0000775 0000000 0000000 00000000000 14703453374 0020426 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.github/workflows/ 0000775 0000000 0000000 00000000000 14703453374 0022463 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/.github/workflows/clojure-linting.yaml 0000664 0000000 0000000 00000001412 14703453374 0026452 0 ustar 00root root 0000000 0000000 name: Clojure Linting
on:
pull_request:
types: [opened, reopened, edited, synchronize]
paths: ['src/**','test/**','.clj-kondo/config.edn','project.clj','.github/**']
jobs:
clojure-linting:
name: Clojure Linting
runs-on: ubuntu-latest
steps:
- name: setup java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: checkout repo
uses: actions/checkout@v2
- name: install clj-kondo (this is quite fast)
run: |
curl -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo
chmod +x install-clj-kondo
./install-clj-kondo --dir .
- name: kondo lint
run: ./clj-kondo --lint src test
puppetlabs-puppetserver-7e1a9a8/.github/workflows/docker.yml 0000664 0000000 0000000 00000003032 14703453374 0024453 0 ustar 00root root 0000000 0000000 name: Docker test and publish
on:
push:
branches:
- main
jobs:
build-and-publish:
env:
PUPPERWARE_ANALYTICS_STREAM: production
IS_LATEST: true
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- run: gem install bundler
- name: Build container
working-directory: docker
run: |
docker system prune --all --force --volumes
docker builder prune --force --keep-storage=10GB
make lint build test
- name: Publish container
working-directory: docker
run: |
docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD"
make publish
- name: Build release container
env:
IS_RELEASE: true
working-directory: docker
shell: bash {0}
run: |
make prep
if [ $? -eq 0 ]; then
make lint build test
else
echo "Skipping release container building and testing"
fi
- name: Publish release container
env:
IS_RELEASE: true
working-directory: docker
shell: bash {0}
run: |
make prep
if [ $? -eq 0 ]; then
make publish
else
echo "Skipping release container publishing"
fi
puppetlabs-puppetserver-7e1a9a8/.github/workflows/mend.yaml 0000664 0000000 0000000 00000003463 14703453374 0024300 0 ustar 00root root 0000000 0000000 name: mend_scan
on:
workflow_dispatch:
push:
branches:
- main
- 7.x
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: connect_twingate
uses: twingate/github-action@v1
with:
service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }}
- name: checkout repo content
uses: actions/checkout@v2 # checkout the repository content to github runner.
with:
fetch-depth: 1
# install java which is required for mend and clojure
- name: setup java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
# install clojure tools
- name: Install Clojure tools
uses: DeLaGuardo/setup-clojure@10.1
with:
# Install just one or all simultaneously
# The value must indicate a particular version of the tool, or use 'latest'
# to always provision the latest version
cli: latest # Clojure CLI based on tools.deps
lein: latest # Leiningen
boot: latest # Boot.clj
bb: latest # Babashka
clj-kondo: latest # Clj-kondo
cljstyle: latest # cljstyle
zprint: latest # zprint
# run lein gen
- name: create pom.xml
run: lein pom
# download mend
- name: download_mend
run: curl -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
- name: run mend
run: env WS_INCLUDES=pom.xml java -jar wss-unified-agent.jar
env:
WS_APIKEY: ${{ secrets.MEND_API_KEY }}
WS_WSS_URL: https://saas-eu.whitesourcesoftware.com/agent
WS_USERKEY: ${{ secrets.MEND_TOKEN }}
WS_PRODUCTNAME: Puppet Enterprise
WS_PROJECTNAME: ${{ github.event.repository.name }}
puppetlabs-puppetserver-7e1a9a8/.github/workflows/pr-testing.yaml 0000664 0000000 0000000 00000001755 14703453374 0025453 0 ustar 00root root 0000000 0000000 name: PR Testing
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, edited, synchronize]
paths: ['src/**','test/**','project.clj']
jobs:
pr-testing:
name: PR Testing
strategy:
fail-fast: false
matrix:
javaargs: ['with-profile fips', '']
filter: [':singlethreaded', ':multithreaded']
version: ['11', '17']
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.version }}
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- name: setup gems
run: ./dev-setup
- name: clojure tests
run: lein -U ${{ matrix.javaargs }} test ${{ matrix.filter }}
timeout-minutes: 30
- name: rspec tests
run: rake spec
puppetlabs-puppetserver-7e1a9a8/.gitignore 0000664 0000000 0000000 00000000747 14703453374 0021066 0 ustar 00root root 0000000 0000000 scratch
pom.xml
*jar
/lib/
/classes/
/output/
/targets/
.lein-deps-sum
.lein-failures
target/
log
.bundle
.vagrant
vendor
.nrepl-port
profiles.clj
dev/user.clj
.lein-repl-history
ext/packaging
checkouts
.beaker
.clj-kondo/.cache
.eastwood
# Bundler local state files
Gemfile.lock
Gemfile.local
/.bundle/
# Local test runs drop files into junit and tmp
/junit/
/tmp/
acceptance/scripts/hosts.cfg
/resources/locales.clj
/resources/puppetlabs/puppetserver/*.class
/dev-resources/i18n/bin
puppetlabs-puppetserver-7e1a9a8/.gitmodules 0000664 0000000 0000000 00000000616 14703453374 0021246 0 ustar 00root root 0000000 0000000 [submodule "ruby/puppet"]
path = ruby/puppet
url = https://github.com/puppetlabs/puppet.git
[submodule "ruby/hiera"]
path = ruby/hiera
url = https://github.com/puppetlabs/hiera.git
[submodule "ruby/resource_api"]
path = ruby/resource_api
url = https://github.com/puppetlabs/puppet-resource_api.git
[submodule "ruby/facter"]
path = ruby/facter
url = https://github.com/puppetlabs/facter.git
puppetlabs-puppetserver-7e1a9a8/.travis.yml 0000664 0000000 0000000 00000002152 14703453374 0021177 0 ustar 00root root 0000000 0000000 language: clojure
lein: 2.9.10
dist: jammy
os: linux
script:
- ./ext/travisci/install-java.sh
- ./ext/travisci/test.sh
jobs:
# NOTE: Puppet does not officially support the s390x architecture.
# Testing against this architecture provides value to the open source community,
# but we make no promises about its functionality and may ignore any test failures
# that arise when testing against s390x.
allow_failures:
- arch: s390x
include:
- name: "Java 17"
env:
- JAVA_VERSION=17
- name: "Java 17 w/ FIPS"
env:
- JAVA_VERSION=17
- ADDITIONAL_LEIN_ARGS="with-profile fips"
- name: "Java 17 w/ multithreaded"
env:
- JAVA_VERSION=17
- MULTITHREADED=true
- name: "Java 17 (s390x)"
env:
- JAVA_VERSION=17
arch: s390x
- name: "Java 17 w/ FIPS (s390x)"
env:
- JAVA_VERSION=17
- ADDITIONAL_LEIN_ARGS="with-profile fips"
arch: s390x
- name: "Java 17 w/ multithreaded (s390x)"
env:
- JAVA_VERSION=17
- MULTITHREADED=true
arch: s390x
notifications:
email: false
puppetlabs-puppetserver-7e1a9a8/CODEOWNERS 0000664 0000000 0000000 00000000126 14703453374 0020460 0 ustar 00root root 0000000 0000000 # This repo is owned by the dumpling team
* @puppetlabs/dumpling @puppetlabs/skeletor
puppetlabs-puppetserver-7e1a9a8/Gemfile 0000664 0000000 0000000 00000002650 14703453374 0020364 0 ustar 00root root 0000000 0000000 source ENV['GEM_SOURCE'] || 'https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/'
def location_for(place, fake_version = nil)
if place.is_a?(String) && place =~ /^(git[:@][^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
elsif place.is_a?(String) && place =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
else
[place, { :require => false }]
end
end
# The public_suffix gem used in the dependencies for the packaging gem no longer supports Ruby 2.5
# and bundler is not smart enough to realize that an older version would work in the mix.
gem 'public_suffix', '= 4.0.7'
gem 'packaging', *location_for(ENV['PACKAGING_LOCATION'] || '~> 0.99')
gem 'rake', :group => [:development, :test]
group :test do
gem 'rspec'
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 6.0')
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 2.4")
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 1.0")
gem "beaker-vmpooler", *location_for(ENV['BEAKER_VMPOOLER_VERSION'] || "~> 1.3")
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || "~> 4.0")
gem 'uuidtools'
gem 'httparty'
gem 'master_manipulator'
# docker-api 1.32.0 requires ruby 2.0.0
gem 'docker-api', '1.31.0'
end
if File.exist? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end
puppetlabs-puppetserver-7e1a9a8/LICENSE.md 0000664 0000000 0000000 00000026075 14703453374 0020504 0 ustar 00root root 0000000 0000000 Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
puppetlabs-puppetserver-7e1a9a8/Makefile 0000664 0000000 0000000 00000000044 14703453374 0020524 0 ustar 00root root 0000000 0000000 include dev-resources/Makefile.i18n
puppetlabs-puppetserver-7e1a9a8/README.md 0000664 0000000 0000000 00000012526 14703453374 0020353 0 ustar 00root root 0000000 0000000 # Puppet Server
[Puppet Server](https://puppet.com/docs/puppet/latest/server/about_server.html)
implements Puppet's server-side components for managing
[Puppet](https://puppet.com/docs/puppet/) agents in a distributed,
service-oriented architecture. Puppet Server is built on top of the same
technologies that make [PuppetDB](https://puppet.com/docs/puppetdb/)
successful, and which allow us to greatly improve performance, scalability,
advanced metrics collection, and fine-grained control over the Ruby runtime.
## Release notes
For information about the current and most recent versions of Puppet Server,
see the [release notes](https://puppet.com/docs/puppet/latest/server/release_notes.html).
## Installing Puppet Server
See [Installing Puppet Server from Packages](https://puppet.com/docs/puppet/latest/server/install_from_packages.html)
for complete installation requirements and instructions.
## Ruby and Puppet Server
Puppet Server uses its own JRuby interpreter, which doesn't load gems or other
code from your system Ruby. If you want Puppet Server to load additional gems,
use the Puppet Server-specific `gem` command to install them. See [Puppet
Server and Gems](https://puppet.com/docs/puppet/latest/server/gems.html) for more
information about gems and Puppet Server.
## Configuration
Puppet Server honors almost all settings in `puppet.conf` and should pick them
up automatically. However, we have also introduced some new settings specific
to Puppet Server. See the [Configuration](https://puppet.com/docs/puppet/latest/server/configuration.html)
documentation for details.
For more information on the differences between Puppet Server's support for
`puppet.conf` settings and the Ruby master's, see our documentation of
[differences in `puppet.conf`](https://puppet.com/docs/puppet/latest/server/puppet_conf_setting_diffs.html).
### Certificate authority configuration
Puppet can use its built-in certificate authority (CA) and public key
infrastructure (PKI) tools or use an existing external CA for all of its
secure socket layer (SSL) communications. See certificate authority
[docs](https://puppet.com/docs/puppet/latest/ssl_certificates.html) for details.
### SSL configuration
In network configurations that require external SSL termination, you need to do
a few things differently in Puppet Server. See
[External SSL Termination](https://puppet.com/docs/puppet/latest/server/external_ssl_termination.html)
for details.
## Command-line utilities
Puppet Server provides several command-line utilities for development and
debugging purposes. These commands are all aware of
[`puppetserver.conf`](https://puppet.com/docs/puppet/latest/server/configuration.html),
as well as the gems and Ruby code specific to Puppet Server and Puppet, while
keeping them isolated from your system Ruby.
For more information, see [Puppet Server
Subcommands](https://puppet.com/docs/puppet/latest/server/subcommands.html).
## Known issues
As this application is still in development, there are a few [known
issues](https://puppet.com/docs/puppet/latest/server/known_issues.html)
that you should be aware of.
## Developer documentation
If want to play with our code, these documents should prove useful:
- [Running Puppet Server from source](https://puppet.com/docs/puppet/latest/server/dev_running_from_source.html)
- [Debugging](https://puppet.com/docs/puppet/latest/server/dev_debugging.html)
- [Puppet Server subcommands](https://puppet.com/docs/puppet/latest/server/subcommands.html)
Puppet Server also uses the
[Trapperkeeper](https://github.com/puppetlabs/trapperkeeper) Clojure framework.
## Testing
To run lein tests, do the following:
- Clone the repo with the `--recursive` flag, or after cloning, do `git submodule init && git submodule update`
- Run `./dev-setup`
- Run `lein test`
## Branching strategy
Puppet Server's branching strategy is documented on the [GitHub repo
wiki](https://github.com/puppetlabs/puppetserver/wiki/Branching-Strategy).
## Issue tracker
Have feature requests, found a bug, or want to see what issues are in flight?
Visit our [JIRA project](https://tickets.puppetlabs.com/browse/SERVER).
## License
Copyright © 2013---2018 Puppet
Distributed under the [Apache License, Version
2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
## Special thanks to
### Cursive Clojure
[Cursive](https://cursiveclojure.com/) is a Clojure IDE based on [IntelliJ
IDEA](http://www.jetbrains.com/idea/download/index.html). Several of us at
Puppet use it regularly and couldn't live without it. It's got some really great
editing, refactoring, and debugging features, and the author, Colin Fleming, has
been amazingly helpful and responsive when we have feedback. If you're a Clojure
developer, you should definitely check it out!
### JRuby
[JRuby](http://jruby.org/) is an implementation of the Ruby programming language
that runs on the JVM. It's a fantastic project, and the bridge that allows us to
run Puppet Ruby code while taking advantage of the JVM's advanced features and
libraries. We're very grateful to the developers for building such a great
product and for helping us work through a few bugs that we've discovered along
the way.
## Maintenance
Maintainers: See the [MAINTAINERS file](./MAINTAINERS)
Tickets: For issues in o/s only: https://tickets.puppetlabs.com/browse/SERVER. For issues in PE: https://tickets.puppetlabs.com/browse/PE. Set component = Puppet Server
puppetlabs-puppetserver-7e1a9a8/Rakefile 0000664 0000000 0000000 00000031051 14703453374 0020533 0 ustar 00root root 0000000 0000000 require 'open3'
require 'open-uri'
require 'json'
require 'pp'
PROJECT_ROOT = File.dirname(__FILE__)
ACCEPTANCE_ROOT = ENV['ACCEPTANCE_ROOT'] ||
File.join(PROJECT_ROOT, 'acceptance')
BEAKER_OPTIONS_FILE = File.join(ACCEPTANCE_ROOT, 'config', 'beaker', 'options.rb')
PUPPET_SRC = File.join(PROJECT_ROOT, 'ruby', 'puppet')
PUPPET_LIB = File.join(PROJECT_ROOT, 'ruby', 'puppet', 'lib')
FACTER_LIB = File.join(PROJECT_ROOT, 'ruby', 'facter', 'lib')
PUPPET_SERVER_RUBY_SRC = File.join(PROJECT_ROOT, 'src', 'ruby', 'puppetserver-lib')
PUPPET_SERVER_RUBY_SPEC = File.join(PROJECT_ROOT, 'spec')
PUPPET_SUBMODULE_PATH = File.join('ruby','puppet')
FACTER_SUBMODULE_PATH = File.join('ruby','facter')
# Branch of puppetserver for which to update submodule pins
PUPPETSERVER_BRANCH = ENV['PUPPETSERVER_BRANCH'] || 'main'
# Branch of puppet-agent to track for passing puppet SHA
PUPPET_AGENT_BRANCH = ENV['PUPPET_AGENT_BRANCH'] || 'main'
# Branch of puppet-agent to track for Facter's passing SHA.
# This needs to be separate because for 6.x, we want to use facter#main
# instead of Facter 3.
FACTER_BRANCH = ENV['FACTER_BRANCH'] || 'main'
TEST_GEMS_DIR = File.join(PROJECT_ROOT, 'vendor', 'test_gems')
TEST_BUNDLE_DIR = File.join(PROJECT_ROOT, 'vendor', 'test_bundle')
GEM_SOURCE = ENV['GEM_SOURCE'] || "https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/"
# Jenkins uses `$LEIN` configure the lein version to use
LEIN_PATH = ENV['LEIN'] || 'lein'
def assemble_default_beaker_config
if ENV["BEAKER_CONFIG"]
return ENV["BEAKER_CONFIG"]
end
platform = ENV['PLATFORM']
layout = ENV['LAYOUT']
if platform and layout
beaker_config = "#{ACCEPTANCE_ROOT}/config/beaker/jenkins/"
beaker_config += "#{platform}-#{layout}.cfg"
else
abort "Must specify an appropriate value for BEAKER_CONFIG. See acceptance/README.md"
end
return beaker_config
end
def setup_smoke_hosts_config
sh "bundle exec beaker-hostgenerator centos7-64m-64a > acceptance/scripts/hosts.cfg"
end
def basic_smoke_test(package_version)
beaker = "PACKAGE_BUILD_VERSION=#{package_version}"
beaker += " bundle exec beaker --debug --root-keys --repo-proxy"
beaker += " --preserve-hosts always"
beaker += " --type aio"
beaker += " --helper acceptance/lib/helper.rb"
beaker += " --options-file #{BEAKER_OPTIONS_FILE}"
beaker += " --load-path acceptance/lib"
beaker += " --config acceptance/scripts/hosts.cfg"
beaker += " --keyfile ~/.ssh/id_rsa-acceptance"
beaker += " --pre-suite acceptance/suites/pre_suite/foss"
beaker += " --post-suite acceptance/suites/post_suite"
beaker += " --tests acceptance/suites/tests/00_smoke"
sh beaker
end
# TODO: this could be DRY'd up with the method above, but it seemed like it
# might make it a little harder to read and didn't seem worth the effort yet
def re_run_basic_smoke_test
beaker = "bundle exec beaker --debug --root-keys --repo-proxy"
beaker += " --preserve-hosts always"
beaker += " --type aio"
beaker += " --helper acceptance/lib/helper.rb"
beaker += " --options-file #{BEAKER_OPTIONS_FILE}"
beaker += " --load-path acceptance/lib"
beaker += " --config acceptance/scripts/hosts.cfg"
beaker += " --keyfile ~/.ssh/id_rsa-acceptance"
beaker += " --tests acceptance/suites/tests/00_smoke"
sh beaker
end
def jenkins_passing_json_parsed(branch)
passing_url = "http://builds.delivery.puppetlabs.net/passing-agent-SHAs/api/v1/json/report-#{branch}"
uri = URI.parse(passing_url)
begin
# DO NOT use uri-open if accepting user input for the uri
# we've done some simple correction here,
# but not enough to cleanse malicious user input
jenkins_result = uri.open(redirect: false)
rescue OpenURI::HTTPError => e
abort "ERROR: Could not get last passing run data for #{branch} of puppet-agent: '#{e.message}'"
end
begin
jenkins_result_parsed = JSON.parse(jenkins_result.read)
rescue JSON::ParserError => e
abort "ERROR: Could not get valid json for last passing run of #{branch}: '#{e.message}'"
end
end
def lookup_passing_puppetagent_sha(my_jenkins_passing_json)
begin
my_jenkins_passing_json['suite-commit']
rescue => e
abort "ERROR: Could not get last passing suite-commit value for #{PUPPET_AGENT_BRANCH}\n\n #{e}"
end
end
def lookup_passing_puppet_sha(my_jenkins_passing_json)
begin
my_jenkins_passing_json['puppet']
rescue => e
abort "ERROR: Could not get puppet's last passing SHA for #{PUPPET_AGENT_BRANCH}\n\n #{e}"
end
end
def lookup_passing_facter_sha(my_jenkins_passing_json)
begin
my_jenkins_passing_json['facter']
rescue => e
abort "ERROR: Could not get facter's last passing SHA for #{FACTER_BRANCH}\n\n #{e}"
end
end
def update_submodule(submodule_path, submodule_sha, submodule_name)
# ensure we fetch here, or the describe done later could be wrong
git_checkout_command = "cd #{submodule_path} && git fetch origin && " \
"git checkout #{submodule_sha}"
puts("checking out known passing #{submodule_name} version in submodule: `#{git_checkout_command}`")
system(git_checkout_command)
end
def replace_puppet_pins(passing_puppetagent_sha)
# read beaker options hash from its file
puts("replacing puppet-agent SHA in #{BEAKER_OPTIONS_FILE} " \
"with #{passing_puppetagent_sha}")
beaker_options_from_file = eval(File.read(BEAKER_OPTIONS_FILE))
# add puppet-agent version value
beaker_options_from_file[:puppet_build_version] = passing_puppetagent_sha
File.write(BEAKER_OPTIONS_FILE, beaker_options_from_file.pretty_inspect)
end
namespace :dev_deps_update do
desc 'update puppet submodule commit'
task :update_puppet_version do
my_jenkins_passing_json = jenkins_passing_json_parsed(PUPPET_AGENT_BRANCH)
puppet_sha = lookup_passing_puppet_sha(my_jenkins_passing_json)
update_submodule(PUPPET_SUBMODULE_PATH, puppet_sha, 'puppet')
# replace puppet-agent sha pin in beaker options file
replace_puppet_pins(lookup_passing_puppetagent_sha(my_jenkins_passing_json))
end
desc 'update facter submodule commit'
task :update_facter_version do
my_jenkins_passing_json = jenkins_passing_json_parsed(FACTER_BRANCH)
facter_sha = lookup_passing_facter_sha(my_jenkins_passing_json)
update_submodule(FACTER_SUBMODULE_PATH, facter_sha, 'facter')
end
desc 'commit and push; CAUTION: WILL commit and push, upstream, local changes to the puppet submodule and acceptance options'
task :commit_push do
git_commit_command = "git checkout #{PUPPETSERVER_BRANCH} && git add #{PUPPET_SUBMODULE_PATH} " \
"&& git add #{FACTER_SUBMODULE_PATH} && git add #{BEAKER_OPTIONS_FILE} " \
"&& git commit -m '(maint) update submodule versions and agent pin'"
git_push_command = "git checkout #{PUPPETSERVER_BRANCH} && git push origin HEAD:#{PUPPETSERVER_BRANCH}"
puts "committing submodules and agent pin via: `#{git_commit_command}`"
system(git_commit_command)
puts "pushing submodules and agent pin via: `#{git_push_command}`"
system(git_push_command)
end
desc 'update puppet versions and commit and push; CAUTION: WILL commit and push, upstream, local changes to the puppet submodule and acceptance options'
task :update_dev_deps_w_push => [:update_puppet_version, :update_facter_version, :commit_push]
end
namespace :spec do
task :init do
if ! Dir.exist? TEST_GEMS_DIR
## Install bundler
## Line 1 launches the JRuby that we depend on via leiningen
## Line 2 programmatically runs 'gem install bundler' via the gem command that comes with JRuby
gem_install_bundler = <<-CMD
GEM_HOME='#{TEST_GEMS_DIR}' GEM_PATH='#{TEST_GEMS_DIR}' \
#{LEIN_PATH} gem install -i '#{TEST_GEMS_DIR}' bundler --version 2.5.10 --no-document --source '#{GEM_SOURCE}'
CMD
sh gem_install_bundler
path = ENV['PATH']
## Install gems via bundler
## Line 1 makes sure that our local bundler script is on the path first
## Line 2 tells bundler to use puppet's Gemfile
## Line 3 tells JRuby where to look for gems
## Line 4 launches the JRuby that we depend on via leiningen
## Line 5 runs our bundle install script
bundle_install = <<-CMD
PATH='#{TEST_GEMS_DIR}/bin:#{path}' \
BUNDLE_GEMFILE='#{PUPPET_SRC}/Gemfile' \
GEM_HOME='#{TEST_GEMS_DIR}' GEM_PATH='#{TEST_GEMS_DIR}' \
#{LEIN_PATH} run -m org.jruby.Main \
-S bundle install --without extra development packaging --path='#{TEST_BUNDLE_DIR}' --retry=3
CMD
sh bundle_install
end
end
end
desc "Run rspec tests"
task :spec, [:rspec_opts] => ["spec:init"] do |t, args|
rspec_opts = args[:rspec_opts] || './spec'
## Run RSpec via our JRuby dependency
## Line 1 tells bundler to use puppet's Gemfile
## Line 2 tells JRuby where to look for gems
## Line 3 launches the JRuby that we depend on via leiningen
## Line 4 adds all our Ruby source to the JRuby LOAD_PATH
## Line 5 runs our rspec wrapper script
## dang ole real easy man
run_rspec_with_jruby = <<-CMD
BUNDLE_GEMFILE='#{PUPPET_SRC}/Gemfile' \
GEM_HOME='#{TEST_GEMS_DIR}' GEM_PATH='#{TEST_GEMS_DIR}' \
#{LEIN_PATH} run -m org.jruby.Main \
-I'#{PUPPET_SERVER_RUBY_SPEC}' -I'#{PUPPET_LIB}' -I'#{FACTER_LIB}' -I'#{PUPPET_SERVER_RUBY_SRC}' \
./spec/run_specs.rb #{rspec_opts}
CMD
sh run_rspec_with_jruby
end
namespace :test do
namespace :acceptance do
desc "Run beaker based acceptance tests"
task :beaker do |t, args|
# variables that take a limited set of acceptable strings
type = ENV["BEAKER_TYPE"] || "pe"
# variables that take pathnames
beakeropts = ENV["BEAKER_OPTS"] || ""
presuite = ENV["BEAKER_PRESUITE"] || "#{ACCEPTANCE_ROOT}/suites/pre_suite/#{type}"
postsuite = ENV["BEAKER_POSTSUITE"] || ""
helper = ENV["BEAKER_HELPER"] || "#{ACCEPTANCE_ROOT}/lib/helper.rb"
testsuite = ENV["BEAKER_TESTSUITE"] || "#{ACCEPTANCE_ROOT}/suites/tests"
loadpath = ENV["BEAKER_LOADPATH"] || ""
options = ENV["BEAKER_OPTIONSFILE"] || "#{ACCEPTANCE_ROOT}/config/beaker/options.rb"
# variables requiring some assembly
config = assemble_default_beaker_config
beaker = "beaker "
beaker += " -c #{config}"
beaker += " --helper #{helper}"
beaker += " --type #{type}"
beaker += " --options-file #{options}" if options != ''
beaker += " --load-path #{loadpath}" if loadpath != ''
beaker += " --pre-suite #{presuite}" if presuite != ''
beaker += " --post-suite #{postsuite}" if postsuite != ''
beaker += " --tests " + testsuite if testsuite != ''
beaker += " " + beakeropts
sh beaker
end
desc "Do an ezbake build, and then a beaker smoke test off of that build, preserving the vmpooler host"
task :bakeNbeak do
package_version = nil
Open3.popen3("#{LEIN_PATH} with-profile ezbake ezbake build 2>&1") do |stdin, stdout, stderr, thread|
# sleep 5
# puts "STDOUT IS: #{stdout}"
success = true
stdout.each do |line|
if match = line.match(%r|^Your packages will be available at http://builds.delivery.puppetlabs.net/puppetserver/(.*)$|)
package_version = match[1]
elsif line =~ /^Packaging FAILURE\s*$/
success = false
end
puts line
end
exit_code = thread.value
if success == true
puts "PACKAGE VERSION IS #{package_version}"
else
puts "\n\nPACKAGING FAILED! exit code is '#{exit_code}'. STDERR IS:"
puts stderr.read
exit 1
end
end
begin
setup_smoke_hosts_config()
basic_smoke_test(package_version)
rescue => e
puts "\n\nJOB FAILED; PACKAGE VERSION WAS: #{package_version}\n\n"
raise e
end
end
desc "Do a basic smoke test, using the package version specified by PACKAGE_BUILD_VERSION, preserving the vmpooler host"
task :smoke do
package_version = ENV["PACKAGE_BUILD_VERSION"]
unless package_version
STDERR.puts("'smoke' task requires PACKAGE_BUILD_VERSION environment variable")
exit 1
end
setup_smoke_hosts_config()
basic_smoke_test(package_version)
end
desc "Re-run the basic smoke test on the host preserved from a previous run of the 'smoke' task"
task :resmoke do
re_run_basic_smoke_test()
end
end
end
namespace :package do
task :bootstrap do
puts 'Bootstrap is no longer needed, using packaging-as-a-gem'
end
task :implode do
puts 'Implode is no longer needed, using packaging-as-a-gem'
end
end
begin
require 'packaging'
Pkg::Util::RakeUtils.load_packaging_tasks
rescue LoadError => e
puts "Error loading packaging rake tasks: #{e}"
end
puppetlabs-puppetserver-7e1a9a8/acceptance/ 0000775 0000000 0000000 00000000000 14703453374 0021154 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/README.md 0000664 0000000 0000000 00000010541 14703453374 0022434 0 ustar 00root root 0000000 0000000 # Puppet Server Acceptance Testing
This directory is intended to manage acceptance testing for the Puppet Server.
## Acceptance Testing for Dummies
The workflow described here is intended for developers who have access to the
[vmpooler](http://vmpooler.delivery.puppetlabs.net), which currently requires
[VPN access](https://confluence.puppetlabs.com/display/HELP/VPN+access) and as
such is only applicable to Puppet employees. This workflow is intended to
help developers new to the puppetserver project.
The two primary goals of this workflow are to enable the developer to modify
the behavior of acceptance tests in as little time as possible and to operate
in a manner as similar to the production CI system as possible.
If you would like to setup local VMs to develop and exercise acceptance tests,
or would like to learn about additional options beyond the vmpooler
configuration, please see the [README_LOCAL_VM.md](README_LOCAL_VM.md)
document.
-------------------------------------------------------------------------------
**Important:** The commands described in this document assume you are
working at the root of the puppetserver repo, that is, in the
directory that contains the acceptance directory.
-------------------------------------------------------------------------------
## Define environment variables
You'll need to provide environment variables that specify against
which builds of puppetserver and (optionally) puppet-agent to install and
test. You can test an existing build or test a new build with local
changes.
### PACKAGE_BUILD_VERSION when testing an existing build
1. Go to http://builds.delivery.puppetlabs.net/puppetserver/?C=M;O=D to find the
most recent build, or copy the value of the `PACKAGE_BUILD_VERSION` parameter
from a jenkins job you're trying to reproduce.
2. Set `PACKAGE_BUILD_VERSION` to this value. It should look something like:
`6.15.1.SNAPSHOT.2021.01.29T0152`
### PACKAGE_BUILD_VERSION when testing a new build with local changes
1. Run
```
lein clean
lein install
EZBAKE_ALLOW_UNREPRODUCIBLE_BUILDS=true EZBAKE_NODEPLOY=true JENKINS_USER_AUTH=':' lein with-profile ezbake,provided ezbake build
```
This will take a while, and
will result in a build appearing on http://builds.delivery.puppetlabs.net/puppetserver.
2. If successful, it will give you back a URL with the new puppetserver
version at the end, which will look something like `6.15.1.SNAPSHOT.2021.01.29T0152`.
Set `PACKAGE_BUILD_VERSION` to this value.
### PUPPET_BUILD_VERSION (optional)
Define `PUPPET_BUILD_VERSION` as the version of the puppet-agent package upon
which your version of puppetserver depends. This can be a tag or SHA.
Unless you're making changes to the agent specifically, you probably won't need
to set this value. By default, we test against the version defined in the
[beaker options](https://github.com/puppetlabs/puppetserver/blob/6.x/acceptance/config/beaker/options.rb#L14) file.
### PUPPET_LEGACY_VERSION (optional)
If you are testing backwards compatibility against a specific release of
Puppet, the `PUPPET_LEGACY_VERSION` environment variable is available for this
purpose, but is not required.
## Using the handy shell script
We have a script that will run beaker tests for you, relying on the built-in
defaults for all arguments. All you provide is the `PACKAGE_BUILD_VERSION`
environment variable. Thus:
```
PACKAGE_BUILD_VERSION='6.15.1.SNAPSHOT.2021.01.29T0152' acceptance/scripts/generic/testrun.sh -p
```
Running with `-p` will preserve the hosts and leave a `hosts_preserved.yml`
at the top level of the repo.
To reuse the hosts saved from a previous run, specify `-r` instead of `-p`,
that is, `acceptance/scripts/generic/testrun.sh -r`.
See [the script](https://github.com/puppetlabs/puppetserver/blob/6.x/acceptance/scripts/generic/testrun.sh#L41-L50) for additional environment variables you can set and their defaults.
-------------------------------------------------------------------------------
**Note:** You may need to obtain the `~/.ssh/id_rsa-acceptance`
file from a colleague so that beaker can SSH into the target VM's
located in the pooler.
**Note:** [VPN access](https://confluence.puppetlabs.com/display/HELP/VPN+access)
is required when executing tests against vmpooler.
-------------------------------------------------------------------------------
puppetlabs-puppetserver-7e1a9a8/acceptance/config/ 0000775 0000000 0000000 00000000000 14703453374 0022421 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/ 0000775 0000000 0000000 00000000000 14703453374 0023652 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/local/ 0000775 0000000 0000000 00000000000 14703453374 0024744 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/local/el6/ 0000775 0000000 0000000 00000000000 14703453374 0025432 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/local/el6/1host.cfg 0000664 0000000 0000000 00000001125 14703453374 0027150 0 ustar 00root root 0000000 0000000 HOSTS:
centos6-64-1.local:
roles:
- master
- agent
- dashboard
- database
platform: el-6-x86_64
ip: 192.168.56.4
service-wait: true
service-prefix: 'service '
puppetservice: puppetserver
puppetpath: /etc/puppet
group: puppet
puppetbin: /usr/bin/puppet
puppetbindir: /usr/bin
puppetvardir: /opt/puppetlabs/puppet/cache
hieradatadir: /etc/puppet/hieradata
hieraconf: /etc/puppet/hiera.yaml
distmoduledir: /etc/puppet/modules
sitemoduledir: /usr/share/puppet/modules
CONFIG:
nfs_server: none
consoleport: 443
puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/options.rb 0000664 0000000 0000000 00000001034 14703453374 0025670 0 ustar 00root root 0000000 0000000 {:forge_host=>"forgeapi.puppet.com",
:is_puppetserver=>true,
:is_jvm_puppet=>true,
"service-wait"=>true,
"service-prefix"=>"service ",
"service-num-retries"=>1500,
"puppetservice"=>"puppetserver",
"puppetserver-package"=>"puppetserver",
"use-service"=>true,
"master-start-curl-retries"=>60,
"puppetserver-confdir"=>"/etc/puppetlabs/puppetserver/conf.d",
"puppetserver-config"=>
"/etc/puppetlabs/puppetserver/conf.d/puppetserver.conf",
:puppet_build_version=>"2b517c7dd5bed8c26bf13ad858eb43a981dc75d4",
:ssh=>{:config=>true}}
puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/vbox/ 0000775 0000000 0000000 00000000000 14703453374 0024630 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/vbox/el6/ 0000775 0000000 0000000 00000000000 14703453374 0025316 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/vbox/el6/64/ 0000775 0000000 0000000 00000000000 14703453374 0025547 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/vbox/el6/64/1host.cfg 0000664 0000000 0000000 00000001306 14703453374 0027266 0 ustar 00root root 0000000 0000000 HOSTS:
el6-64-1.vm:
roles:
- master
- agent
- dashboard
- database
platform: el-6-x86_64
hypervisor: vagrant
box: centos-6.5-64-nocm
box_url: https://vagrantcloud.com/puppetlabs/centos-6.5-64-nocm/version/2/provider/virtualbox.box
service-wait: true
service-prefix: 'service '
puppetservice: puppetserver
puppetpath: /etc/puppet
group: puppet
puppetbin: /usr/bin/puppet
puppetbindir: /usr/bin
puppetvardir: /var/lib/puppet
hieradatadir: /etc/puppet/hieradata
hieraconf: /etc/puppet/hiera.yaml
distmoduledir: /etc/puppet/modules
sitemoduledir: /usr/share/puppet/modules
CONFIG:
nfs_server: none
consoleport: 443
puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/vbox/el6/64/2hosts.cfg 0000664 0000000 0000000 00000001711 14703453374 0027452 0 ustar 00root root 0000000 0000000 HOSTS:
el6-64-1.vm:
roles:
- master
- agent
- database
platform: el-6-x86_64
hypervisor: vagrant
ip: 192.168.56.20
box: centos-65-x64-vbox4210-nocm
box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
service-wait: true
service-prefix: 'service '
puppetservice: puppetserver
puppetpath: /etc/puppet
group: puppet
puppetbin: /usr/bin/puppet
puppetbindir: /usr/bin
puppetvardir: /var/lib/puppet
hieradatadir: /etc/puppet/hieradata
hieraconf: /etc/puppet/hiera.yaml
distmoduledir: /etc/puppet/modules
sitemoduledir: /usr/share/puppet/modules
el6-64-2.vm:
roles:
- agent
- dashboard
platform: el-6-x86_64
hypervisor: vagrant
ip: 192.168.56.21
box: centos-65-x64-vbox4210-nocm
box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
CONFIG:
nfs_server: none
consoleport: 443
puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/vcenter_dual.cfg 0000664 0000000 0000000 00000002000 14703453374 0026776 0 ustar 00root root 0000000 0000000 HOSTS:
master:
roles:
- master
- agent
- dashboard
- database
platform: el-6-x86_64
template: Delivery/Quality Assurance/Templates/vCloud/centos-6-x86_64
hypervisor: vcloud
service-wait: true
service-prefix: 'service '
puppetservice: puppetserver
puppetpath: /etc/puppet
group: puppet
puppetbin: /usr/bin/puppet
puppetbindir: /usr/bin
puppetvardir: /opt/puppetlabs/puppet/cache
hieradatadir: /etc/puppet/hieradata
hieraconf: /etc/puppet/hiera.yaml
distmoduledir: /etc/puppet/modules
sitemoduledir: /usr/share/puppet/modules
agent:
roles:
- agent
- dashboard
platform: el-6-x86_64
template: Delivery/Quality Assurance/Templates/vCloud/centos-6-x86_64
hypervisor: vcloud
CONFIG:
pooling_api: http://vcloud.delivery.puppetlabs.net
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Staging/Dynamic
resourcepool: delivery/Quality Assurance/Staging/Dynamic
puppetlabs-puppetserver-7e1a9a8/acceptance/config/beaker/vcenter_mono.cfg 0000664 0000000 0000000 00000001521 14703453374 0027030 0 ustar 00root root 0000000 0000000 HOSTS:
master:
roles:
- master
- agent
- dashboard
- database
platform: el-6-x86_64
template: Delivery/Quality Assurance/Templates/vCloud/centos-6-x86_64
hypervisor: vcloud
service-wait: true
service-prefix: 'service '
puppetservice: puppetserver
puppetpath: /etc/puppet
group: puppet
puppetbin: /usr/bin/puppet
puppetbindir: /usr/bin
puppetvardir: /opt/puppetlabs/puppet/cache
hieradatadir: /etc/puppet/hieradata
hieraconf: /etc/puppet/hiera.yaml
distmoduledir: /etc/puppet/modules
sitemoduledir: /usr/share/puppet/modules
CONFIG:
pooling_api: http://vcloud.delivery.puppetlabs.net
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Staging/Dynamic
resourcepool: delivery/Quality Assurance/Staging/Dynamic
puppetlabs-puppetserver-7e1a9a8/acceptance/config/nodes/ 0000775 0000000 0000000 00000000000 14703453374 0023531 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/config/nodes/redhat7-64m-windows2008r2-64a.yaml 0000664 0000000 0000000 00000001343 14703453374 0031216 0 ustar 00root root 0000000 0000000 ---
HOSTS:
redhat7-64-1:
roles:
- agent
- master
hypervisor: vcloud
pe_dir:
pe_ver:
pe_upgrade_dir:
pe_upgrade_ver:
platform: el-7-x86_64
template: Delivery/Quality Assurance/Templates/vCloud/redhat-7-x86_64
windows2008r2-64-2:
roles:
- agent
hypervisor: vcloud
pe_dir:
pe_ver:
pe_upgrade_dir:
pe_upgrade_ver:
platform: windows-2008r2-64
template: Delivery/Quality Assurance/Templates/vCloud/win-2008r2-x86_64
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Enterprise/Dynamic
resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
puppetlabs-puppetserver-7e1a9a8/acceptance/lib/ 0000775 0000000 0000000 00000000000 14703453374 0021722 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/lib/helper.rb 0000664 0000000 0000000 00000037650 14703453374 0023541 0 ustar 00root root 0000000 0000000 require 'beaker/dsl/install_utils'
require 'net/http'
require 'json'
require 'beaker-puppet'
module PuppetServerExtensions
# Configuration code largely obtained from:
# https://github.com/puppetlabs/classifier/blob/master/integration/helper.rb
#
def self.initialize_config(options)
base_dir = File.join(File.dirname(__FILE__), '..')
install_type = get_option_value(options[:puppetserver_install_type],
[:git, :package], "install type", "PUPPETSERVER_INSTALL_TYPE", :package, :symbol)
install_mode =
get_option_value(options[:puppetserver_install_mode],
[:install, :upgrade], "install mode",
"PUPPETSERVER_INSTALL_MODE", :install, :symbol)
puppetserver_version =
get_option_value(options[:puppetserver_version],
nil, "Puppet Server Version",
"PUPPETSERVER_VERSION", nil, :string)
# puppet-agent version corresponds to packaged development version located at:
# http://builds.delivery.puppetlabs.net/puppet-agent/
# This value now come from the beaker options file, or PUPPET_BUILD_VERSION env var
# the beaker options file can have this value updated via the rake task
puppet_build_version = get_option_value(options[:puppet_build_version],
nil, "Puppet Agent Development Build Version",
"PUPPET_BUILD_VERSION",
nil,
:string)
# puppetdb version corresponds to packaged development version located at:
# http://builds.delivery.puppetlabs.net/puppetdb/
puppetdb_build_version =
get_option_value(options[:puppetdb_build_version], nil,
"PuppetDB Version", "PUPPETDB_BUILD_VERSION", "5.2.4", :string)
@config = {
:base_dir => base_dir,
:puppetserver_install_type => install_type,
:puppetserver_install_mode => install_mode,
:puppetserver_version => puppetserver_version,
:puppet_build_version => puppet_build_version,
:puppetdb_build_version => puppetdb_build_version,
}
end
def self.print_config
pp_config = PP.pp(@config, "")
Beaker::Log.notify "Puppet Server Acceptance Configuration:\n\n#{pp_config}\n\n"
end
# PuppetDB development packages aren't available on as many platforms as
# Puppet Server's packages, so we need to restrict the PuppetDB-related
# testing to a subset of the platforms.
# This guards both the installation of the PuppetDB package repository file
# and the running of the PuppetDB test(s).
def puppetdb_supported_platforms()
[
/debian-11/,
/debian-12/,
/el-8/,
/el-9/,
/sles-12/,
/sles-15/,
/ubuntu-20.04/,
/ubuntu-22.04/,
/ubuntu-24.04/
]
end
class << self
attr_reader :config
end
# Return the configuration hash initialized by
# PuppetServerExtensions.initialize_config
#
def test_config
PuppetServerExtensions.config
end
def self.get_option_value(value, legal_values, description,
env_var_name = nil, default_value = nil, value_type = :symbol)
# precedence is environment variable, option file, default value
value = ((env_var_name && ENV[env_var_name]) || value || default_value)
if value == "" and value_type == :string
value = default_value
elsif value and value_type == :symbol
value = value.to_sym
end
unless legal_values.nil? or legal_values.include?(value)
raise ArgumentError, "Unsupported #{description} '#{value}'"
end
value
end
def puppetserver_initialize_ssl
hostname = on(master, 'facter hostname').stdout.strip
fqdn = on(master, 'facter fqdn').stdout.strip
step "Clear SSL on all hosts"
hosts.each do |host|
ssldir = on(host, puppet('agent --configprint ssldir')).stdout.chomp
cadir = on(host, puppet('agent --configprint cadir')).stdout.chomp
on(master, 'puppet resource service puppetserver ensure=stopped') if host == master
on(host, "rm -rf '#{ssldir}'/*")
on(host, "rm -rf '#{cadir}'/*")
if host == master
on(host, 'puppetserver ca setup')
on(master, 'puppet resource service puppetserver ensure=running')
end
end
step "Server: Start Puppet Server"
old_retries = master['master-start-curl-retries']
master['master-start-curl-retries'] = 300
with_puppet_running_on(master, "main" => { "autosign" => true, "dns_alt_names" => "puppet,#{hostname},#{fqdn}", "verbose" => true, "daemonize" => true }) do
hosts.each do |host|
step "Agents: Run agent --test first time to gen CSR"
response = on(host, puppet("agent --test --server #{master}"), :acceptable_exit_codes => [0,1])
if response.exit_code == 1
if response.stdout.match?(/Certificate (.+) has not been signed yet/)
Beaker::Log.notify "Cert not signed, possibly due to 'puppet resource service puppetserver ensure=running' returning early, retrying in 20 seconds"
sleep 20
on(host, puppet("agent --test --server #{master}"), :acceptable_exit_codes => [0])
else
fail_test("Exit code of 1 with unexpected stdout:\n#{response.stdout}")
end
end
end
end
master['master-start-curl-retries'] = old_retries
end
def puppet_server_collect_data(host, relative_path)
variant, version, _, _ = master['platform'].to_array
# This is an ugly hack to accomodate the difficulty around getting systemd
# to output the daemon's standard out to the same place that the init
# scripts typically do.
use_journalctl = false
case variant
when /^fedora$/
if version.to_i >= 15
use_journalctl = true
end
when /^(el|centos)$/
if version.to_i >= 7
use_journalctl = true
end
when /^debian$/
if version.to_i >= 8
use_journalctl = true
end
when /^ubuntu$/
if version.to_i >= 15
use_journalctl = true
end
when /^sles$/
if version.to_i >= 12
use_journalctl = true
end
end
destination = File.join("./log/latest/puppetserver/", relative_path)
FileUtils.mkdir_p(destination)
scp_from master, "/var/log/puppetlabs/puppetserver/puppetserver.log", destination
if use_journalctl
puppetserver_daemon_log = on(master, "journalctl -u puppetserver", :acceptable_exit_codes => [0,1]).stdout.strip
destination = File.join(destination, "puppetserver-daemon.log")
File.open(destination, 'w') {|file| file.puts puppetserver_daemon_log }
else
scp_from master, "/var/log/puppetlabs/puppetserver/puppetserver-daemon.log", destination
end
end
def install_puppet_server (host, make_env={})
install_puppet_server_deps
case test_config[:puppetserver_install_type]
when :package
install_package host, 'puppetserver'
when :git
project_version = 'puppetserver-version='
project_version += test_config[:puppetserver_version] ||
`lein with-profile ci pprint :version | tail -n 1 | cut -d\\" -f2`
install_from_ezbake host, 'puppetserver', project_version, make_env
else
abort("Invalid install type: " + test_config[:puppetserver_install_type])
end
end
def install_puppet_server_deps
variant = master['platform'].variant
version = master['platform'].version
if variant == 'debian' && version == "8"
create_remote_file(master,
"/etc/apt/sources.list.d/jessie-backports.list",
"deb https://artifactory.delivery.puppetlabs.net/artifactory/debian_archive__remote/ jessie-backports main")
on master, 'apt-get update'
master.install_package("openjdk-8-jre-headless")
on master, 'update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java'
end
end
def get_defaults_file
package_name = options['puppetserver-package']
variant, _, _, _ = master['platform'].to_array
case variant
when /^(fedora|el|centos|sles)$/
defaults_dir = "/etc/sysconfig/"
when /^(debian|ubuntu)$/
defaults_dir = "/etc/default/"
else
logger.warn("#{platform}: Unsupported platform for puppetserver.")
end
File.join(defaults_dir, package_name)
end
def get_defaults_var(host, varname)
defaults_file = get_defaults_file
on(host, "source #{defaults_file}; echo -n $#{varname}").stdout
end
# If we are getting the certificate for the first time, store it in the
# beaker host options hash. Else, return the stored certificate from the
# beaker host options hash
def get_cert(host)
if host.host_hash[:cert].class == OpenSSL::X509::Certificate then
return host.host_hash[:cert]
else
cert = encode_cert(host, host.puppet['hostcert'])
host.host_hash[:cert] = cert
return cert
end
end
# Convert the contents of the certificate file in cert_file on the host
# specified by cert_host into an X.509 certificate and return it
# cert_host: The host whose cert you want
# cert_file: The specific cert file you want
# silent : Suppress Beaker's output; set to false to see it
def encode_cert(cert_host, cert_file, silent = true)
rawcert = on(cert_host, "cat #{cert_file}", {:silent => silent}).stdout.strip
OpenSSL::X509::Certificate.new(rawcert)
end
# Gets the key from the host hash if it is present, other wise uses
# the encode_key method to get the key from the host, and stores it in the
# host hash
def get_key(host)
if host.host_hash[:key].class == OpenSSL::PKey::RSA then
return host.host_hash[:key]
else
key = encode_key(host, host.puppet['hostprivkey'])
host.host_hash[:key] = key
return key
end
end
# Convert the contents of the private key file in key_file on the host
# specified by key_host into an RSA private key and return it
# key_host: The host whose key you want
# key_file: The specific key file you want
# silent : Suppress Beaker's output; set to false to see it
def encode_key(key_host, key_file, silent = true)
rawkey = on(key_host, "cat #{key_file}", {:silent => silent}).stdout.strip
OpenSSL::PKey::RSA.new(rawkey)
end
# Issue an HTTP request and return the Net::HTTPResponse object. Lifted from
# https://github.com/puppetlabs/pe_acceptance_tests/blob/2015.3.x/lib/http_calls.rb
# and slightly modified.
# url: (String) URL to poke
# method: (Symbol) :post, :get
# cert: (OpenSSL::X509::Certificate, nil) The certificate to
# use for authentication.
# key: (OpenSSL::PKey::RSA, nil) The private key to use for
# authentication
# body: (String) Request body (default empty)
require 'net/http'
require 'uri'
def https_request(url, request_method, cert = nil, key = nil, body = nil, options = {})
# Make insecure https request
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
if cert
if cert.is_a?(OpenSSL::X509::Certificate)
http.cert = cert
else
raise TypeError, "cert must be an OpenSSL::X509::Certificate object, not #{cert.class}"
end
end
if key
if key.is_a?(OpenSSL::PKey::RSA)
http.key = key
else
raise TypeError, "key must be an OpenSSL::PKey:RSA object, not #{key.class}"
end
end
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.read_timeout = options[:read_timeout] if options[:read_timeout]
if request_method == :post
request = Net::HTTP::Post.new(uri.request_uri)
# Needs the content type even though no data is being sent
request.content_type = 'application/json'
request.body = body
else
request = Net::HTTP::Get.new(uri.request_uri)
end
start = Time.now
response = http.request(request)
stop = Time.now
logger.debug "Remote took #{stop - start} to respond"
response
end
def reload_server(host = master, opts = {})
service = options['puppetservice']
on(host, "service #{service} reload", opts)
end
def apply_one_hocon_setting(hocon_host,
hocon_file_path,
hocon_setting,
hocon_value)
hocon_manifest =<<-EOF.gsub(/^ {6}/, '')
hocon_setting { "#{hocon_setting}":
ensure => present,
path => "#{hocon_file_path}",
setting => "#{hocon_setting}",
value => #{hocon_value},
}
EOF
apply_manifest_on(hocon_host, hocon_manifest,
{:acceptable_exit_codes => [0,2]})
end
def delete_one_hocon_setting(hocon_host,
hocon_file_path,
hocon_setting)
hocon_manifest =<<-EOF.gsub(/^ {6}/, '')
hocon_setting { "#{hocon_setting}":
ensure => absent,
path => "#{hocon_file_path}",
setting => "#{hocon_setting}",
}
EOF
apply_manifest_on(hocon_host, hocon_manifest,
{:acceptable_exit_codes => [0,2]})
end
# appends match-requests to TK auth.conf
# Provides many defaults so that users of this method can simply
# and easily allow a host in TK auth.conf
#
# NOTE: This method allows the caller to define invalid TK auth rules
# by design.
#
# TK Auth is documented here:
# https://github.com/puppetlabs/puppetserver/blob/master
# /documentation/config_file_auth.md
#
# Arguments:
# cn: The cannonical name, usually put in an "allow" or "deny"
# name: The friendly name of the match-request
# host: The system under test. Typcially master.
# allow: hostname, glob, or regex lookback to allow.
# allow_unauthenticated:
# Boolean value. Only adds the allow-unauthenticated behavior if
# true.
# deny: hostname, glob or regex lookback to deny
# sort_order:
# path:
# type: Valid values are 'path' or 'regex'
# method: Should accept string or array or strings.
# Valid strings include 'head', 'get', 'put', 'post', 'delete'
#
require 'hocon/config_factory'
def append_match_request(args)
cn = args[:cn] #The cannonical name to allow.
name = args[:name] || args[:cn] #friendly name.
host = args[:host] || master
allow = args[:allow]|| args[:cn]
allow_unauthenticated = args[:allow_unauthenticated] || false
deny = args[:deny] || false
sort_order = args[:sort_order] || 77
path = args[:path] || '/'
type = args[:type] || 'path'
default_http_methods = ['head', 'get', 'put', 'post', 'delete']
method = args[:method] || default_http_methods
query_params = args[:query_params] || {}
#TODO: handle TK-293 X509 extensions.
authconf_file = args[:authconf_file] ||
options[:'puppetserver-confdir']+'/auth.conf'
match_request = { 'match-request' =>
{ 'path' => path,
'type' => type,
'method' => method,
},
'sort-order' => sort_order,
'name' => name
}
#Note: If you set 'allow', 'allow-unauthenticated', and 'deny' you will
#have an invalid match-request.
match_request.merge!('allow' => allow) if allow
match_request.merge!('allow-unauthenticated' => true) if allow_unauthenticated
match_request.merge!('deny' => deny) if deny
authconf_text = on(master, "cat #{authconf_file}").stdout
authconf_hash = Hocon.parse(authconf_text)
authconf_hash['authorization']['rules'] << match_request
modify_tk_config(host, authconf_file, authconf_hash, true)
end
# parses text into json if possible
def parse_json(text)
begin
json = JSON.parse(text)
rescue JSON::ParserError => e
fail_test "Response body is not parseable JSON\n" +
"Exception message: #{e.message}\n" +
"Text to parse: #{text}\n"
end
return json
end
end
Beaker::TestCase.send(:include, PuppetServerExtensions)
puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppet_x/ 0000775 0000000 0000000 00000000000 14703453374 0023566 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppet_x/acceptance/ 0000775 0000000 0000000 00000000000 14703453374 0025654 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppet_x/acceptance/external_cert_fixtures.rb 0000664 0000000 0000000 00000026160 14703453374 0032776 0 ustar 00root root 0000000 0000000 module PuppetX
module Acceptance
class ExternalCertFixtures
attr_reader :fixture_dir
attr_reader :test_dir
attr_reader :master_name
attr_reader :agent_name
##
# ExternalCerts provides a utility class to fill in fixture data and other
# large blobs of text configuration for the acceptance testing of External CA
# behavior.
#
# @param [String] fixture_dir The fixture directory to read from.
#
# @param [String] test_dir The directory on the remote system, used for
# filling in templates.
#
# @param [String] master_name The common name the master should be reachable
# at. This name should match up with the certificate files in the fixture
# directory, e.g. master1.example.org.
#
# @param [String] agent_name The common name the agent is configured to use.
# This name should match up with the certificate files in the fixture
# directory, e.g.
def initialize(fixture_dir, test_dir, master_name = "master1.example.org", agent_name = "agent1.example.org")
@fixture_dir = fixture_dir
@test_dir = test_dir
@master_name = master_name
@agent_name = agent_name
end
def master_short_name
@master_short_name ||= master_name.gsub(/\..*/, '')
end
def host_entry
@host_entry ||= "127.0.0.3 #{master_name} #{master_short_name} puppet"
end
def root_ca_cert
@root_ca_cert ||= File.read(File.join(fixture_dir, 'root', 'ca-root.crt'))
end
def agent_ca_cert
@agent_ca_cert ||= File.read(File.join(fixture_dir, 'agent-ca', 'ca-agent-ca.crt'))
end
def master_ca_cert
@master_ca_cert ||= File.read(File.join(fixture_dir, 'master-ca', 'ca-master-ca.crt'))
end
def master_ca_crl
@master_ca_crl ||= File.read(File.join(fixture_dir, 'master-ca', 'ca-master-ca.crl'))
end
def agent_cert
@agent_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.issued_by.agent-ca.crt"))
end
def agent_key
@agent_key ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.issued_by.agent-ca.key"))
end
def agent_email_cert
@agent_email_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.email.issued_by.agent-ca.crt"))
end
def agent_email_key
@agent_email_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.email.issued_by.agent-ca.key"))
end
def master_cert
@master_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.master-ca.crt"))
end
def master_key
@master_key ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.master-ca.key"))
end
def master_cert_rogue
@master_cert_rogue ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.agent-ca.crt"))
end
def master_key_rogue
@master_key_rogue ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.agent-ca.key"))
end
## Configuration files
def agent_conf
@agent_conf ||= <<-EO_AGENT_CONF
[main]
color = false
certname = #{agent_name}
server = #{master_name}
certificate_revocation = false
# localcacert must contain the Root CA certificate to complete the 2 level CA
# chain when an intermediate CA certificate is being used. Either the HTTP
# server must send the intermediate certificate during the handshake, or the
# agent must use the `ssl_client_ca_auth` setting to provide the client
# certificate.
localcacert = #{test_dir}/ca_root.crt
EO_AGENT_CONF
end
def agent_conf_email
@agent_conf ||= <<-EO_AGENT_CONF
[main]
color = false
certname = #{agent_name}
server = #{master_name}
certificate_revocation = false
hostcert = #{test_dir}/agent_email.crt
hostkey = #{test_dir}/agent_email.key
localcacert = #{test_dir}/ca_root.crt
EO_AGENT_CONF
end
def agent_conf_crl
@agent_conf_crl ||= <<-EO_AGENT_CONF
[main]
certname = #{agent_name}
server = #{master_name}
# localcacert must contain the Root CA certificate to complete the 2 level CA
# chain when an intermediate CA certificate is being used. Either the HTTP
# server must send the intermediate certificate during the handshake, or the
# agent must use the `ssl_client_ca_auth` setting to provide the client
# certificate.
localcacert = #{test_dir}/ca_root.crt
EO_AGENT_CONF
end
def master_conf
@master_conf ||= <<-EO_MASTER_CONF
[master]
ca = false
certname = #{master_name}
ssl_client_header = HTTP_X_CLIENT_DN
ssl_client_verify_header = HTTP_X_CLIENT_VERIFY
EO_MASTER_CONF
end
##
# Passenger Rack compliant config.ru which is responsible for starting the
# Puppet master.
def config_ru
@config_ru ||= <<-EO_CONFIG_RU
\$0 = "master"
ARGV << "--rack"
ARGV << "--confdir=#{test_dir}/etc/master"
ARGV << "--vardir=#{test_dir}/etc/master/var"
require 'puppet/util/command_line'
run Puppet::Util::CommandLine.new.execute
EO_CONFIG_RU
end
##
# auth_conf should return auth authorization file that allows *.example.org
# access to to the full REST API.
def auth_conf
@auth_conf_content ||= File.read(File.join(fixture_dir, 'auth.conf'))
end
##
# Apache configuration with Passenger
def httpd_conf
@httpd_conf ||= <<-EO_HTTPD_CONF
User apache
Group apache
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 60
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule passenger_module modules/mod_passenger.so
ServerName #{master_name}
DocumentRoot "#{test_dir}/etc/master/public"
DefaultType text/plain
TypesConfig /etc/mime.types
# Same thing, just using a certificate issued by the Agent CA, which should not
# be trusted by the clients.
Listen 8140 https
Listen 8141 https
SSLEngine on
SSLProtocol ALL -SSLv2
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
SSLCertificateFile "#{test_dir}/master.crt"
SSLCertificateKeyFile "#{test_dir}/master.key"
# The chain file is sent to the client during handshake.
SSLCertificateChainFile "#{test_dir}/ca_master_bundle.crt"
# The CA cert file is used to authenticate clients
SSLCACertificateFile "#{test_dir}/ca_agent_bundle.crt"
SSLVerifyClient optional
SSLVerifyDepth 2
SSLOptions +StdEnvVars
RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e
DocumentRoot "#{test_dir}/etc/master/public"
PassengerRoot /usr/share/gems/gems/passenger-3.0.17
PassengerRuby /usr/bin/ruby
RackAutoDetect On
RackBaseURI /
SSLEngine on
SSLProtocol ALL -SSLv2
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
SSLCertificateFile "#{test_dir}/master_rogue.crt"
SSLCertificateKeyFile "#{test_dir}/master_rogue.key"
SSLCertificateChainFile "#{test_dir}/ca_agent_bundle.crt"
SSLCACertificateFile "#{test_dir}/ca_agent_bundle.crt"
SSLVerifyClient optional
SSLVerifyDepth 2
SSLOptions +StdEnvVars
RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e
DocumentRoot "#{test_dir}/etc/master/public"
PassengerRoot /usr/share/gems/gems/passenger-3.0.17
PassengerRuby /usr/bin/ruby
RackAutoDetect On
RackBaseURI /
EO_HTTPD_CONF
end
##
# webserver.conf for a trustworthy master for use with Jetty
def jetty_webserver_conf_for_trustworthy_master
@jetty_webserver_conf_for_trustworthy_master ||= <<-EO_WEBSERVER_CONF
webserver: {
client-auth: want
ssl-host: 0.0.0.0
ssl-port: 8140
ssl-cert: "#{test_dir}/master.crt"
ssl-key: "#{test_dir}/master.key"
ssl-cert-chain: "#{test_dir}/ca_master_bundle.crt"
ssl-ca-cert: "#{test_dir}/ca_agent_bundle.crt"
}
EO_WEBSERVER_CONF
end
##
# webserver.conf for a rogue master for use with Jetty
def jetty_webserver_conf_for_rogue_master
@jetty_webserver_conf_for_rogue_master ||= <<-EO_WEBSERVER_CONF
webserver: {
client-auth: want
ssl-host: 0.0.0.0
ssl-port: 8140
ssl-cert: "#{test_dir}/master_rogue.crt"
ssl-key: "#{test_dir}/master_rogue.key"
ssl-cert-chain: "#{test_dir}/ca_agent_bundle.crt"
ssl-ca-cert: "#{test_dir}/ca_agent_bundle.crt"
}
EO_WEBSERVER_CONF
end
end
end
end
puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppet_x/acceptance/pki.rb 0000664 0000000 0000000 00000013237 14703453374 0026772 0 ustar 00root root 0000000 0000000 require 'openssl'
module PuppetX
module Acceptance
module PKI
PRIVATE_KEY_LENGTH = 2048
FIVE_YEARS = 5 * 365 * 24 * 60 * 60
CA_EXTENSIONS = [
["basicConstraints", "CA:TRUE", true],
["keyUsage", "keyCertSign, cRLSign", true],
["subjectKeyIdentifier", "hash", false],
["authorityKeyIdentifier", "keyid:always", false]
]
NODE_EXTENSIONS = [
["keyUsage", "digitalSignature", true],
["subjectKeyIdentifier", "hash", false]
]
DEFAULT_SIGNING_DIGEST = OpenSSL::Digest::SHA256.new
DEFAULT_REVOCATION_REASON = OpenSSL::OCSP::REVOKED_STATUS_KEYCOMPROMISE
ROOT_CA_NAME = "/CN=root-ca-\u{2070E}"
REVOKED_INT_CA_NAME = "/CN=revoked-int-ca-\u16A0"
INT_CA_NAME = "/CN=unrevoked-int-ca\u06FF\u16A0\u{2070E}"
LEAF_CA_NAME = "/CN=leaf-ca-\u06FF"
EXPLANATORY_TEXT = <<-EOT
# Root Issuer: #{ROOT_CA_NAME}
# Intermediate Issuer: #{INT_CA_NAME}
# Leaf Issuer: #{LEAF_CA_NAME}
EOT
def self.create_private_key(length = PRIVATE_KEY_LENGTH)
OpenSSL::PKey::RSA.new(length)
end
def self.self_signed_ca(key, name)
cert = OpenSSL::X509::Certificate.new
cert.public_key = key.public_key
cert.subject = OpenSSL::X509::Name.parse(name)
cert.issuer = cert.subject
cert.version = 2
cert.serial = rand(2**128)
not_before = just_now
cert.not_before = not_before
cert.not_after = not_before + FIVE_YEARS
ext_factory = extension_factory_for(cert, cert)
CA_EXTENSIONS.each do |ext|
extension = ext_factory.create_extension(*ext)
cert.add_extension(extension)
end
cert.sign(key, DEFAULT_SIGNING_DIGEST)
cert
end
def self.create_csr(key, name)
csr = OpenSSL::X509::Request.new
csr.public_key = key.public_key
csr.subject = OpenSSL::X509::Name.parse(name)
csr.version = 2
csr.sign(key, DEFAULT_SIGNING_DIGEST)
csr
end
def self.sign(ca_key, ca_cert, csr, extensions = NODE_EXTENSIONS)
cert = OpenSSL::X509::Certificate.new
cert.public_key = csr.public_key
cert.subject = csr.subject
cert.issuer = ca_cert.subject
cert.version = 2
cert.serial = rand(2**128)
not_before = just_now
cert.not_before = not_before
cert.not_after = not_before + FIVE_YEARS
ext_factory = extension_factory_for(ca_cert, cert)
extensions.each do |ext|
extension = ext_factory.create_extension(*ext)
cert.add_extension(extension)
end
cert.sign(ca_key, DEFAULT_SIGNING_DIGEST)
cert
end
def self.create_crl_for(ca_cert, ca_key)
crl = OpenSSL::X509::CRL.new
crl.version = 1
crl.issuer = ca_cert.subject
ef = extension_factory_for(ca_cert)
crl.add_extension(
ef.create_extension(["authorityKeyIdentifier", "keyid:always", false]))
crl.add_extension(
OpenSSL::X509::Extension.new("crlNumber", OpenSSL::ASN1::Integer(0)))
not_before = just_now
crl.last_update = not_before
crl.next_update = not_before + FIVE_YEARS
crl.sign(ca_key, DEFAULT_SIGNING_DIGEST)
crl
end
def self.revoke(serial, crl, ca_key)
revoked = OpenSSL::X509::Revoked.new
revoked.serial = serial
revoked.time = Time.now
revoked.add_extension(
OpenSSL::X509::Extension.new("CRLReason",
OpenSSL::ASN1::Enumerated(DEFAULT_REVOCATION_REASON)))
crl.add_revoked(revoked)
extensions = crl.extensions.group_by{|e| e.oid == 'crlNumber' }
crl_number = extensions[true].first
unchanged_exts = extensions[false]
next_crl_number = crl_number.value.to_i + 1
new_crl_number_ext = OpenSSL::X509::Extension.new("crlNumber",
OpenSSL::ASN1::Integer(next_crl_number))
crl.extensions = unchanged_exts + [new_crl_number_ext]
crl.sign(ca_key, DEFAULT_SIGNING_DIGEST)
crl
end
# Creates a self-signed root ca, an intermediate ca, and a leaf ca.
# Creates CRLs for each ca
# Returns the certs in a bundle, the crls in a bundle and the
# private key for the leaf ca
def self.create_chained_pki(leaf_name)
root_key = create_private_key
root_cert = self_signed_ca(root_key, ROOT_CA_NAME)
root_crl = create_crl_for(root_cert, root_key)
int_key = create_private_key
int_csr = create_csr(int_key, INT_CA_NAME)
int_cert = sign(root_key, root_cert, int_csr, CA_EXTENSIONS)
int_crl = create_crl_for(int_cert, int_key)
leaf_key = create_private_key
leaf_csr = create_csr(leaf_key, "/CN=#{leaf_name}")
leaf_cert = sign(int_key, int_cert, leaf_csr, CA_EXTENSIONS)
leaf_crl = create_crl_for(leaf_cert, leaf_key)
cert_bundle = bundle(leaf_cert, int_cert, root_cert)
crl_chain = bundle(leaf_crl, int_crl, root_crl)
{
:private_key => leaf_key,
:cert_bundle => cert_bundle,
:crl_chain => crl_chain
}
end
private
def self.just_now
# Give us some slack in possible clock skew between hosts
Time.now - 300
end
def self.extension_factory_for(ca, cert = nil)
ef = OpenSSL::X509::ExtensionFactory.new
ef.issuer_certificate = ca
ef.subject_certificate = cert if cert
ef
end
def self.bundle(*items)
items.map {|i| EXPLANATORY_TEXT + i.to_pem }.join("\n")
end
end
end
end
puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppetserver/ 0000775 0000000 0000000 00000000000 14703453374 0024466 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppetserver/acceptance/ 0000775 0000000 0000000 00000000000 14703453374 0026554 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppetserver/acceptance/compat_utils.rb 0000664 0000000 0000000 00000002037 14703453374 0031606 0 ustar 00root root 0000000 0000000 def sitepp
'/etc/puppetlabs/code/environments/production/manifests/site.pp'
end
def nonmaster_agents()
agents.reject { |agent| agent == master }
end
def apply_simmons_class(agent, studio, classname)
create_remote_file(master, sitepp, < "#{studio}",
exercises => [#{classname}],
}
SITEPP
on(master, "chmod 644 #{sitepp}")
with_puppet_running_on(master, {"master" => {"autosign" => true}}) do
on(agent, puppet("agent --test --digest_algorithm sha256"), :acceptable_exit_codes => [0,2])
end
end
def rm_compat_test_files()
# In order to prevent file caching and ensure agent-master HTTP communication
# during agent runs we blow away the vardirs, which contains the cached files
hosts.each do |host|
vardir = on(host, puppet("config print vardir")).stdout.chomp
on(host, "rm -rf #{vardir}")
end
# Remove any custom site.pp file which may have been laid down so that it
# doesn't pollute the outcome from any additional tests which are run.
on(master, "rm -f #{sitepp}")
end
puppetlabs-puppetserver-7e1a9a8/acceptance/lib/puppetserver/acceptance/gem_utils.rb 0000664 0000000 0000000 00000001022 14703453374 0031064 0 ustar 00root root 0000000 0000000 def get_gem_list(host, gem_list_command)
# regex for creating list of (gem, version)
# NOTE: version here can take a few different forms:
# (X.Y.Z)
# (Z.Y.Z java)
# (X.Y.Z, X.Y.Z2)
#
gem_list_regex = Regexp.new('(?[\w-]*) (?.*)')
array = []
on(host, "#{gem_list_command}") do |result|
split_output = result.stdout.split
split_output.each do |line|
match = gem_list_regex.match(line)
if match
array << match.captures
end
end
end
return array
end
puppetlabs-puppetserver-7e1a9a8/acceptance/scripts/ 0000775 0000000 0000000 00000000000 14703453374 0022643 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/scripts/external_ca/ 0000775 0000000 0000000 00000000000 14703453374 0025130 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/scripts/external_ca/retest.sh 0000775 0000000 0000000 00000001727 14703453374 0027004 0 ustar 00root root 0000000 0000000 #!/bin/bash
set -x
export GEM_SOURCE=https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
export GENCONFIG_LAYOUT="${GENCONFIG_LAYOUT:-redhat6-64ma-redhat6-64a-redhat6-64u}"
export BEAKER_TESTSUITE="${BEAKER_TESTSUITE:-acceptance/suites/tests/020-external-ca/}"
export BEAKER_PRESUITE="${BEAKER_PRESUITE:-acceptance/suites/pre_suite/foss}"
export BEAKER_POSTSUITE="acceptance/suites/post_suite/"
export BEAKER_OPTIONS="acceptance/config/beaker/options.rb"
export BEAKER_CONFIG="hosts_preserved.yml"
export BEAKER_KEYFILE="~/.ssh/id_rsa-acceptance"
export BEAKER_HELPER="acceptance/lib/helper.rb"
bundle install --path vendor/bundle
bundle exec beaker \
--no-provision \
--hosts $BEAKER_CONFIG \
--type aio \
--helper $BEAKER_HELPER \
--options-file $BEAKER_OPTIONS \
--tests $BEAKER_TESTSUITE \
--post-suite $BEAKER_POSTSUITE \
--keyfile $BEAKER_KEYFILE \
--load-path "acceptance/lib" \
--preserve-hosts \
--debug \
--timeout 360
puppetlabs-puppetserver-7e1a9a8/acceptance/scripts/external_ca/test_preserve_hosts.sh 0000775 0000000 0000000 00000002215 14703453374 0031601 0 ustar 00root root 0000000 0000000 #!/bin/bash
set -x
export GEM_SOURCE=https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
export GENCONFIG_LAYOUT="${GENCONFIG_LAYOUT:-redhat6-64ma-redhat6-64a-redhat6-64u}"
export BEAKER_TESTSUITE="${BEAKER_TESTSUITE:-acceptance/suites/tests/00_smoke}"
export BEAKER_PRESUITE="${BEAKER_PRESUITE:-acceptance/suites/pre_suite/foss}"
export BEAKER_POSTSUITE="acceptance/suites/post_suite/"
export BEAKER_OPTIONS="acceptance/config/beaker/options.rb"
export BEAKER_CONFIG="acceptance/scripts/hosts.cfg"
export BEAKER_KEYFILE="~/.ssh/id_rsa-acceptance"
export BEAKER_HELPER="acceptance/lib/helper.rb"
# export PACKAGE_BUILD_VERSION="2.1.2.SNAPSHOT.2015.08.20T0208"
bundle install --path vendor/bundle
bundle exec beaker-hostgenerator $GENCONFIG_LAYOUT > $BEAKER_CONFIG
bundle exec beaker \
--config $BEAKER_CONFIG \
--type aio \
--helper $BEAKER_HELPER \
--options-file $BEAKER_OPTIONS \
--tests $BEAKER_TESTSUITE \
--post-suite $BEAKER_POSTSUITE \
--pre-suite $BEAKER_PRESUITE \
--keyfile $BEAKER_KEYFILE \
--load-path "acceptance/lib" \
--preserve-hosts \
--debug \
--timeout 360
cp log/latest/hosts_preserved.yml .
puppetlabs-puppetserver-7e1a9a8/acceptance/scripts/generic/ 0000775 0000000 0000000 00000000000 14703453374 0024257 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/scripts/generic/testrun.sh 0000775 0000000 0000000 00000005143 14703453374 0026325 0 ustar 00root root 0000000 0000000 #!/bin/bash
do_init()
{
if [ -z "$PACKAGE_BUILD_VERSION" ];
#TODO: Read last passing SHA file on builds.pl.d.net
then echo "$0: PACKAGE_BUILD_VERSION not set. Please export PACKAGE_BUILD_VERSION."
exit -1;
fi
bundle exec beaker-hostgenerator --hypervisor abs $GENCONFIG_LAYOUT > $BEAKER_CONFIG
BEAKER_INIT="bundle exec beaker init --debug"
BEAKER_INIT="$BEAKER_INIT --type aio"
BEAKER_INIT="$BEAKER_INIT --keyfile $BEAKER_KEYFILE"
BEAKER_INIT="$BEAKER_INIT --helper $BEAKER_HELPER"
BEAKER_INIT="$BEAKER_INIT --options-file $BEAKER_OPTIONS"
BEAKER_INIT="$BEAKER_INIT --load-path $BEAKER_LOADPATH"
BEAKER_INIT="$BEAKER_INIT --hosts $BEAKER_CONFIG"
BEAKER_INIT="$BEAKER_INIT --pre-suite $BEAKER_PRESUITE"
BEAKER_INIT="$BEAKER_INIT --tests $BEAKER_TESTSUITE"
BEAKER_INIT="$BEAKER_INIT --debug --timeout 360"
$BEAKER_INIT
if [ $? != 0 ] ; then
echo "Initialization failed!"
exit -1;
fi
bundle exec beaker provision
if [ $? != 0 ] ; then
echo "Provision failed!"
exit -1;
fi
}
set -x
export GEM_SOURCE="https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/"
export GENCONFIG_LAYOUT="${GENCONFIG_LAYOUT:-redhat9-64ma-debian12-64a}"
export BEAKER_TESTSUITE="${BEAKER_TESTSUITE:-acceptance/suites/tests}"
export BEAKER_PRESUITE="${BEAKER_PRESUITE:-acceptance/suites/pre_suite/foss}"
export BEAKER_OPTIONS="${BEAKER_OPTIONS:-acceptance/config/beaker/options.rb}"
export BEAKER_CONFIG="${BEAKER_CONFIG:-acceptance/scripts/hosts.cfg}"
export BEAKER_KEYFILE="${BEAKER_KEYFILE:-~/.ssh/id_rsa-acceptance}"
export BEAKER_HELPER="${BEAKER_HELPER:-acceptance/lib/helper.rb}"
export BEAKER_LOADPATH="${BEAKER_LOADPATH:-acceptance/lib}"
bundle install --path vendor/bundle
case $1 in
-p | --p* )
do_init
bundle exec beaker exec
echo "Preserving hosts, run `bundle exec beaker exec ` to use the same hosts again."
;;
-r | --r* )
if [ ! -s ./.beaker/subcommand_options.yaml ];
then echo "$0: Can not find subcommand_options.yaml; cannot run without init.\n \
Use this script with -p to create new hosts and initialize them."
exit -1;
fi
bundle exec beaker exec $BEAKER_TESTSUITE
;;
* ) # Preserve hosts on failure
do_init
bundle exec beaker exec
if [ $? = 0 ] ; then
echo "Run completed successfully, destroying hosts."
bundle exec beaker destroy
rm .beaker/subcommand_options.yaml
else
echo "Run failed, preserving hosts. Run against these hosts again with `bundle exec beaker exec `."
echo "Alternatively, run this script again with `-r`."
fi
;;
esac
puppetlabs-puppetserver-7e1a9a8/acceptance/scripts/test-full-puppet3compat.sh 0000775 0000000 0000000 00000000516 14703453374 0027725 0 ustar 00root root 0000000 0000000 #!/bin/bash
set -x
# command line parameters
export GENCONFIG_LAYOUT="${GENCONFIG_LAYOUT:-redhat6-64ma-debian6-64a-windows2008r2-64a}"
export BEAKER_TESTSUITE="${BEAKER_TESTSUITE:-acceptance/suites/puppet3_tests}"
export BEAKER_PRESUITE="acceptance/suites/pre_suite/puppet3_compat"
bash ./acceptance/scripts/generic/testrun-full.sh
puppetlabs-puppetserver-7e1a9a8/acceptance/suites/ 0000775 0000000 0000000 00000000000 14703453374 0022470 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/ 0000775 0000000 0000000 00000000000 14703453374 0025175 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat/ 0000775 0000000 0000000 00000000000 14703453374 0031062 5 ustar 00root root 0000000 0000000 binary_file_test.rb 0000664 0000000 0000000 00000001737 14703453374 0034662 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'binary file resource'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('binary_file_test')
step "Apply simmons::binary_file to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::binary_file')
end
step "Validate binary-file" do
sha256 = on(agent, "sha256sum #{studio}/binary-file | awk '{print $1}'").stdout.chomp
assert_equal('55a26d3939c947e4455e8f48ffb4724170aa4f9aa4c8d58c57800ad2026f4d79', sha256)
end
step "Validate binary-file filebucket backup" do
old_sha256 = on(agent, "sha256sum #{studio}/binary-file-old | awk '{print $1}'").stdout.chomp
on(agent, puppet("filebucket restore #{studio}/binary-file-backup --digest_algorithm sha256 #{old_sha256}"))
diff = on(agent, "diff #{studio}/binary-file-old #{studio}/binary-file-backup").exit_code
assert_equal(0, diff, 'binary-file was not backed up to filebucket')
end
end
content_file_test.rb 0000664 0000000 0000000 00000000775 14703453374 0035051 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'content file resource'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('content_file_test')
step "Apply simmons::content_file to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::content_file')
end
step "Validate content-file" do
contents = on(agent, "cat #{studio}/content-file").stdout.chomp
assert_equal('Static content defined in manifest', contents)
end
end
custom_fact_output_test.rb 0000664 0000000 0000000 00000001045 14703453374 0036316 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'custom fact'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('custom_fact_output_test')
step "Apply simmons::custom_fact_output to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::custom_fact_output')
end
step "Validate custom-fact-output" do
expected = on(agent, "hostname").stdout.chomp
content = on(agent, "cat #{studio}/custom-fact-output").stdout.chomp
assert_equal(expected, content)
end
end
external_fact_output_test.rb 0000664 0000000 0000000 00000001074 14703453374 0036630 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'executable external fact'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('external_fact_output_test')
step "Apply simmons::external_fact_output to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::external_fact_output')
end
step "Validate external-fact-output" do
expected = on(agent, "hostname").stdout.chomp
content = on(agent, "cat #{studio}/external-fact-output").stdout.chomp
assert_equal(expected, content)
end
end
mount_point_binary_file_test.rb 0000664 0000000 0000000 00000001125 14703453374 0037304 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'binary file resource from custom mount point'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('mount_point_binary_file_test')
step "Apply simmons::mount_point_binary_file to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::mount_point_binary_file')
end
step "Validate mount-point-binary-file" do
md5 = on(agent, "md5sum #{studio}/mount-point-binary-file | awk '{print $1}'").stdout.chomp
assert_equal('4b392568e0c19886bf274663a63b7d18', md5)
end
end
mount_point_source_file_test.rb 0000664 0000000 0000000 00000001114 14703453374 0037316 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'source file resource from custom mount point'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('mount_point_source_file_test')
step "Apply simmons::mount_point_source_file to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::mount_point_source_file')
end
step "Validate mount-point-source-file" do
contents = on(agent, "cat #{studio}/mount-point-source-file").stdout.chomp
assert_equal('File served from custom mount point', contents)
end
end
recursive_directory_test.rb 0000664 0000000 0000000 00000002127 14703453374 0036464 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'recursive directory file resource'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('recursive_directory_test')
step "Apply simmons::recursive_directory to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::recursive_directory')
end
step "Validate recursive-directory" do
directory_exists = on(agent, "test -d #{studio}/recursive-directory").exit_code
assert_equal(0, directory_exists)
file1_contents = on(agent, "cat #{studio}/recursive-directory/file1").stdout.chomp
assert_equal('recursive file 1', file1_contents)
file2_contents = on(agent, "cat #{studio}/recursive-directory/file2").stdout.chomp
assert_equal('recursive file 2', file2_contents)
subdir_exists = on(agent, "test -d #{studio}/recursive-directory/subdir").exit_code
assert_equal(0, subdir_exists)
subfile_contents = on(agent, "cat #{studio}/recursive-directory/subdir/subfile").stdout.chomp
assert_equal('recursive subfile contents', subfile_contents)
end
end
source_file_test.rb 0000664 0000000 0000000 00000001646 14703453374 0034675 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/compat_tests/020_backwards_compat require 'puppetserver/acceptance/compat_utils'
test_name 'source file resource'
teardown do
rm_compat_test_files()
end
agents.each do |agent|
studio = agent.tmpdir('source_file_test')
step "Apply simmons::source_file to agent #{agent.platform}" do
apply_simmons_class(agent, studio, 'simmons::source_file')
end
step "Validate source-file" do
contents = on(agent, "cat #{studio}/source-file").stdout.chomp
assert_equal('Static source file contents', contents)
end
step "Validate source-file filebucket backup" do
old_sha256 = on(agent, "sha256sum #{studio}/source-file-old | awk '{print $1}'").stdout.chomp
on(agent, puppet("filebucket restore #{studio}/source-file-backup --digest_algorithm sha256 #{old_sha256}"))
diff = on(agent, "diff #{studio}/source-file-old #{studio}/source-file-backup").exit_code
assert_equal(0, diff, 'source-file was not backed up to filebucket')
end
end
puppetlabs-puppetserver-7e1a9a8/acceptance/suites/post_suite/ 0000775 0000000 0000000 00000000000 14703453374 0024666 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/post_suite/99_collect_data.rb 0000664 0000000 0000000 00000000132 14703453374 0030146 0 ustar 00root root 0000000 0000000 step "Preserve Puppet Server Log Files"
puppet_server_collect_data master, 'post_suite'
puppetlabs-puppetserver-7e1a9a8/acceptance/suites/pre_suite/ 0000775 0000000 0000000 00000000000 14703453374 0024467 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/pre_suite/compat_common/ 0000775 0000000 0000000 00000000000 14703453374 0027322 5 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/pre_suite/compat_common/00_setup_environment.rb 0000664 0000000 0000000 00000000121 14703453374 0033724 0 ustar 00root root 0000000 0000000 step "Initialize Test Config"
PuppetServerExtensions.initialize_config options
puppetlabs-puppetserver-7e1a9a8/acceptance/suites/pre_suite/compat_common/30_install_dev_repos.rb 0000664 0000000 0000000 00000001202 14703453374 0033660 0 ustar 00root root 0000000 0000000 install_opts = options.merge({ :dev_builds_repos => ["PC1"]})
if test_config[:puppetserver_install_type] == :package
package_build_version = ENV['PACKAGE_BUILD_VERSION']
if package_build_version.nil?
abort("Environment variable PACKAGE_BUILD_VERSION required for package installs!")
end
step "Setup Puppet Server dev repository on the master." do
install_puppetlabs_dev_repo(master, 'puppetserver', package_build_version, nil, install_opts)
end
step "Setup Puppet dev repository on the master." do
install_puppetlabs_dev_repo(master, 'puppet-agent', test_config[:puppet_build_version], nil, install_opts)
end
end
puppetlabs-puppetserver-7e1a9a8/acceptance/suites/pre_suite/compat_common/70_install_puppetmaster.rb0000664 0000000 0000000 00000000073 14703453374 0034434 0 ustar 00root root 0000000 0000000 step "Install Puppet Server."
install_puppet_server master
71_install_simmons_module.rb 0000664 0000000 0000000 00000001032 14703453374 0034653 0 ustar 00root root 0000000 0000000 puppetlabs-puppetserver-7e1a9a8/acceptance/suites/pre_suite/compat_common simmons_version = '0.3.3'
step "Install nwolfe-simmons module #{simmons_version}" do
on(master, puppet("module install nwolfe-simmons --version #{simmons_version}"))
end
step "Configure file serving" do
fileserverconf = on(master, puppet("config print fileserverconfig")).stdout.chomp
create_remote_file(master, fileserverconf, <