4 changes: 0 additions & 4 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
fixtures:
repositories:
pe_manager:
repo: "git@github.com:puppetlabs/puppetlabs-pe_manager.git"
ref: origin/2016.2.x
symlinks:
pe_support_script: "#{source_dir}"
102 changes: 102 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,104 @@
## [Release 2.7.0] - 2018-04-13

### Summary

Feature and bugfix release of the Support Script bundled with PE 2017.3.6
and PE 2018.1.0. See release notes for version 1.9.0 for a list of
improvements and bugfixes.


## Release 2.6.0

### Summary

Feature and bugfix release of the Support Script bundled with PE 2017.2.5 and
PE 2017.3.2, PE 2017.3.3, PE 2017.3.4, and PE 2017.3.5. See release notes for
version 1.8.0 for a list of improvements and bugfixes.


## Release 2.5.0

### Summary

Feature release of the Support Script bundled with PE 2017.2.4 and PE 2017.3.0.
See release notes for version 1.7.0 for a list of improvements and bugfixes.


## Release 2.4.0

### Summary

Feature release of the Support Script bundled with PE 2017.2.3. See release
notes for version 1.6.0 for a list of improvements and bugfixes.


## Release 2.3.0

### Summary

Feature release of the Support Script bundled with PE 2017.2.2. See release
notes for version 1.5.0 for a list of improvements and bugfixes.


## Release 2.2.0

### Summary

Feature release of the Support Script bundled with PE 2017.2.1.

### Features

- A list of active nodes is gathered from the Orchestrator inventory
API along with the PuppetDB nodes dataset.

- All improvements and bugfixes from version 1.4.0.


## Release 2.1.0

### Summary

Feature release of the Support Script bundled with PE 2016.5.2 and 2017.1.0.

### Features

- All improvements and bugfixes from version 1.3.0.

### Bug Fixes

- Support script help now includes a note that some old enterprise
subcommands moved to the puppet infrastructure command.


## Release 2.0.0

### Summary

Major release of the Support Script bundled with PE 2016.5.0.

### Features

- The support script is now distributed to agent nodes via pluginsync.
This is made possible by changes in PE 2016.5.0 which migrated other PE
modules to the `puppet infrastructure` subcommand, which allows the
support script to take sole ownership of the `puppet enterprise`
subcommand.

- All improvements and bugfixes from version 1.2.0.

### Breaking Changes

- This version of the module requires PE 2016.5.0 or newer.

- In order to support pluginsync, the support script has moved from:

files/puppet-enterprise-support

to:

lib/puppet_x/puppetlabs/support_script/v1/puppet-enterprise-support.sh


## [Release 1.9.0] - 2018-04-13

### Summary
Expand Down Expand Up @@ -252,4 +353,5 @@ installations, not agents.
- Console status check timeout has been increased from 5 seconds to 60
seconds.

[Release 2.7.0]: https://github.com/puppetlabs/puppetlabs-pe_support_script/compare/5d0c9ba...2.7.0
[Release 1.9.0]: https://github.com/puppetlabs/puppetlabs-pe_support_script/compare/c01f3b9...1.9.0
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
source "https://rubygems.org"
source "http://rubygems.delivery.puppetlabs.net"

group :test do
gem "rake", ">= 10.1"
gem "beaker", "~> 3.0"
gem "beaker-abs", "~> 0.2"
gem "beaker-pe", "~> 1.11"
gem "scooter", "~> 3.2"
gem "beaker-pe-large-environments", "~> 0.1.8"
gem "puppet", ENV['PUPPET_VERSION'] || "~> 4.5"
gem "rspec", "~> 3.4"
gem "rspec-puppet", '~> 2.0'
Expand Down
2 changes: 1 addition & 1 deletion ext/run_acceptance_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# ./ext/run_acceptance_tests.sh 2017.1

PE_TEST_SERIES=${1-"2016.4"}
PE_TEST_SERIES=${1-"2017.3"}
LATEST_GOOD_BUILD=$(curl -q "http://getpe.delivery.puppetlabs.net/latest/${PE_TEST_SERIES}")

echo "Testing build: ${LATEST_GOOD_BUILD?}"
Expand Down
14 changes: 14 additions & 0 deletions lib/puppet/application/enterprise.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'puppet/application/face_base'

# This subcommand is implemented as a face. The definition of the application
# can be found in face/enterprise.rb.
class Puppet::Application::Enterprise < Puppet::Application::FaceBase
# Call Puppet's settings.use method (which is idempotent) during the
# application's setup phase to have it create all necessary objects and
# directories for a PE install via a puppet apply.
#
def setup
super
Puppet.settings.use(:main)
end
end
25 changes: 25 additions & 0 deletions lib/puppet/face/enterprise.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'puppet/indirector/face'

Puppet::Face.define(:enterprise, '1.0.0') do
copyright "Puppet", 2016
license "Puppet Enterprise Software License Agreement"

summary "Commands to facilitate support of Puppet Enterprise."
description <<-'EOT'
This subcommand uses Puppet to collect information about your Puppet
Enterprise installation for support.
**NOTE:** If you are looking for "puppet enterprise configure", that
command has moved to:
puppet infrastructure configure
EOT

action :help do
default
summary "Display help about the enterprise subcommand."
when_invoked do |*args|
Puppet::Face[:help, '0.0.1'].help('enterprise')
end
end
end
2 changes: 1 addition & 1 deletion lib/puppet/face/enterprise/support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
end

support_module = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
support_script = File.join(support_module, 'files/puppet-enterprise-support')
support_script = File.join(support_module, 'lib/puppet_x/puppetlabs/support_script/v1/puppet-enterprise-support.sh')

Kernel.exec('/bin/bash', support_script, *support_script_parameters)
end
Expand Down
36 changes: 23 additions & 13 deletions files/puppet-enterprise-support → ...rt_script/v1/puppet-enterprise-support.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ readonly SERVER_BIN_DIR='/opt/puppetlabs/server/bin'
readonly SERVER_DATA_DIR='/opt/puppetlabs/server/data'
readonly DEFAULT_OUTPUT_DIRECTORY='/var/tmp'
readonly SCRIPT_NAME="$(basename "${0}")"
readonly SCRIPT_VERSION='1.9.0'
readonly SCRIPT_VERSION='2.7.0'
readonly PUPPET_PUBKEY="-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)
Expand Down Expand Up @@ -1123,19 +1123,10 @@ list_pe_and_module_files() {
# Gather all modules installed on the modulepath
# Expects enterprise/puppetserver_environments.json to already be in place from puppetserver_environments()
module_listing() {
local environments=$("${PUPPET_BIN_DIR}/ruby" -rjson -e 'puts JSON.load(ARGF.read)["environments"].keys.join(" ")' "${DROP}/enterprise/puppetserver_environments.json")
local agent_cert=$("${PUPPET_BIN_DIR}/puppet" config print --section agent hostcert)
local agent_key=$("${PUPPET_BIN_DIR}/puppet" config print --section agent hostprivkey)

run_diagnostic "${PUPPET_BIN_DIR?}/puppet module list --color=false" "enterprise/modules.txt"
run_diagnostic "${PUPPET_BIN_DIR?}/puppet module list --render-as yaml" "enterprise/modules.yaml"

mkdir -p "${DROP}/enterprise/modules"
for env in $environments; do
if [ "$env" == "production" ]; then
continue
fi
run_diagnostic "${PUPPET_BIN_DIR?}/puppet module list --color=false --environment=$env" "enterprise/modules/modules-${env}.txt"
run_diagnostic "${PUPPET_BIN_DIR?}/puppet module list --render-as yaml --environment=$env" "enterprise/modules/modules-${env}.yaml"
done
run_diagnostic "${PUPPET_BIN_DIR}/curl --silent --show-error --connect-timeout 5 --max-time 60 -k https://${PLATFORM_HOSTNAME}:8140/puppet/v3/environment_modules --cert ${agent_cert} --key ${agent_key}" "enterprise/modules.json"
}

# Check r10k deployment status
Expand Down Expand Up @@ -1296,6 +1287,23 @@ orchestration_status() {
run_diagnostic "${PUPPET_BIN_DIR}/curl --silent --show-error --connect-timeout 5 --max-time 60 -k https://127.0.0.1:8143/status/v1/services?level=debug" "enterprise/orchestration_status.json"
}

# Collects inventory from the Orchestration Services api if an API token is available
#
# Global Variables Used:
# PUPPET_BIN_DIR
# HOME
#
# Arguments:
# None
#
# Returns:
# None
orchestration_inventory() {
if [[ -e ${HOME}/.puppetlabs/token ]]; then
run_diagnostic "${PUPPET_BIN_DIR?}/curl --silent --show-error --connect-timeout 5 --max-time 60 -k -H X-Authentication:$(cat "${HOME?}/.puppetlabs/token") https://127.0.0.1:8143/orchestrator/v1/inventory" "enterprise/orchestration_inventory.json"
fi
}

# Collects output from the Puppet Server status endpoint
#
# Global Variables Used:
Expand Down Expand Up @@ -1441,6 +1449,7 @@ puppetdb_status() {
q_puppetdb_plaintext_port="$(get_ini_field '/etc/puppetlabs/puppetdb/conf.d/jetty.ini' 'port')"
run_diagnostic "${PUPPET_BIN_DIR}/curl --silent --show-error --connect-timeout 5 --max-time 60 -X GET http://127.0.0.1:${q_puppetdb_plaintext_port}/status/v1/services?level=debug" "enterprise/puppetdb_status.json"
run_diagnostic "${PUPPET_BIN_DIR}/curl --silent --show-error --connect-timeout 5 --max-time 60 -X GET http://127.0.0.1:${q_puppetdb_plaintext_port}/pdb/admin/v1/summary-stats" "enterprise/puppetdb_summary_stats.json"
run_diagnostic "${PUPPET_BIN_DIR}/curl --silent --show-error --connect-timeout 5 --max-time 60 -X GET http://127.0.0.1:${q_puppetdb_plaintext_port}/pdb/query/v4 --data-urlencode 'query=nodes[certname] {deactivated is null and expired is null}'" "enterprise/puppetdb_nodes.json"
fi
}

Expand Down Expand Up @@ -1650,6 +1659,7 @@ fi

if is_package_installed 'pe-orchestration-services'; then
orchestration_status
orchestration_inventory
fi

if is_package_installed 'pe-postgresql-server'; then
Expand Down
5 changes: 3 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"name": "puppetlabs-pe_support_script",
"version": "1.9.0",
"version": "2.7.0",
"author": "puppetlabs",
"summary": "Provides the enterprise support command.",
"license": "Puppet Enterprise Software License Agreement",
"source": "https://github.com/puppetlabs/pe_support_script",
"project_page": "https://github.com/puppetlabs/pe_support_script",
"issues_url": "",
"dependencies": [],
"dependencies": [
],
"requirements": [
{
"name": "pe",
"version_requirement": ">= 2016.2.0"
"version_requirement": ">= 2016.5.0"
}
],
"operatingsystem_support": [
Expand Down
54 changes: 54 additions & 0 deletions tests/beaker/configs/centos7-64am-64ad-64ac-64compile_master.af
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
HOSTS:
centos7-64-1:
pe_dir:
pe_ver:
pe_upgrade_dir:
pe_upgrade_ver:
hypervisor: vmpooler
platform: el-7-x86_64
template: centos-7-x86_64
roles:
- agent
- master
centos7-64-2:
pe_dir:
pe_ver:
pe_upgrade_dir:
pe_upgrade_ver:
hypervisor: vmpooler
platform: el-7-x86_64
template: centos-7-x86_64
roles:
- agent
- database
centos7-64-3:
pe_dir:
pe_ver:
pe_upgrade_dir:
pe_upgrade_ver:
hypervisor: vmpooler
platform: el-7-x86_64
template: centos-7-x86_64
roles:
- agent
- dashboard
centos7-64-4:
pe_dir:
pe_ver:
pe_upgrade_dir:
pe_upgrade_ver:
hypervisor: vmpooler
platform: el-7-x86_64
template: centos-7-x86_64
roles:
- agent
- frictionless
- compile_master
main:
dns_alt_names: puppet
environmentpath: "/etc/puppetlabs/puppet/environments"
CONFIG:
nfs_server: none
consoleport: 443
pooling_api: http://vmpooler.delivery.puppetlabs.net/
12 changes: 10 additions & 2 deletions tests/beaker/pre-suite/00_pe_install.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
test_name 'PE-15434 - - Install Puppet Enterprise' do
step 'Install PE' do
install_pe
if hosts_as('compile_master').empty?
step 'Install PE' do
install_pe
end
else
require 'beaker-pe-large-environments'

step 'Install PE LEI' do
install_lei
end
end
end
8 changes: 5 additions & 3 deletions tests/beaker/pre-suite/02_run_support_script.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
test_name 'PE-15434 - - Run Support Script' do
step 'Run Support Script' do
hosts.each do |host|
hosts.each do |host|
step "Run Support Script on #{host.name} : #{host['roles'].join(',')}" do
result = on(host, puppet('enterprise support', 'ENV' => {'BEAKER_TESTING' => '1'}))
output_tarball = result.stdout.match(/^Support data is located at (.*)$/).captures.first

stage_dir = create_tmpdir_on(host)
on(host, "tar xzf #{output_tarball} -C #{stage_dir}")
# Using a pipeline accomodates SUN tar, which doesn't support the z flag
# for unzipping tarballs or the -C flag when extracting.
on(host, "cd #{stage_dir} && gunzip -c #{output_tarball}|tar xf -")

# Save path to extracted data in host object so that tests can inspect it.
host['support_script_output'] = File.join(stage_dir, File.basename(output_tarball, '.tar.gz'))
Expand Down