(PE-15433) Import enteprise-dist support script
This commit imports the existing bash support script from puppetlabs/enterprise-dist@d9a5457. Files imported: - puppet-enterprise-support - installer/utilities
(PE-15433) Implement puppet enterprise support command
This patch adds a initial implementation for the `puppet enterprise support` face. When invoked, the subcommand locates the support script and execs it.
Merge pull request #1 from Sharpie/pe-15433-import-support-script
(PE-15433) Move support script to pe_support_script module
(PE-15434) Add host configs for monolithic masters
This patch adds beaker host configurations for each monolithic master platform supported by PE 2016.2: - centos6-64mdca - centos7-64mdca - sles11-64mdca - sles12-64mdca - ubuntu1204-64mdca - ubuntu1404-64mdca - ubuntu1604-64mdca These configurations were created by beaker-hostgenerator 0.6.0.
(PE-15434) Mock MEEP support in test pre-suite
This patch adds a step to the module installation part of the Beaker pre-suite which mocks up the directory structure created by the MEEP installer. Once the beaker-pe library supports the MEEP installer, this test step can be reverted.
(PE-15434) Run Support Script in pre-suite
This patch adds a step to the pre-suite that executes `puppet enterprise support` and unpacks the resulting tarball for inspection by later tests. This also serves as a basic smoke test for the support script.
Merge pull request #2 from Sharpie/pe-15434-start-test-suite
(PE-15434) Start Beaker acceptance suite for Support Script
(PE-15435) Add constants for PE filesystem locations
This patch adds the following constants as read-only global variables: - PUPPET_BIN_DIR - SERVER_BIN_DIR - SERVER_DATA_DIR Previously, these constants were defined in the utilities file. The locations for PE 2016.2.x are used, which are backwards-compatible to 2015.2.x, but not compatible with 3.x.
(PE-15435) Copy display functions from utilities
This patch copies the following output generation functions from the utilities library: - display - display_newline Use of complicated display functions, such as display_wrapped_text, have been removed along with decorative functions such as display_major_separator.
(PE-15435) Implement fail function
This patch adds a fail function along with a variant of display_error copied from the utilities library. An instance of display_failure is replaced with fail.
(PE-15435) Replace wherefore with cmd
The support script had a handful of locations where the wherefore function from the utilities library was used to test for command existance. This patch replaces the wherefore function with a standard cmd function which is a simple wrapper around the shell builtin hash that can be used to test for existance without the need to suppress output.
(PE-15435) Remove installer exception handler
The exception handler executes some rollback and cleanup logic for the installer, finalizes some logfiles, and then displays an error message. The support script doesn't use any of the state that is cleaned up or rolled back and doesn't write to the installer logfile, so the only benefit we get out of this is an error message which shows up if the script is canceled with CTRL-C. This patch removes the exception handlers as the error message isn't worth the additional complexity.
(PE-15435) Replace quit function with a simple exit
The quit function from the utilities library removes a workdir and finalizes log files. The support script doesn't write to a logfile and uses its own DROP directory instead of the workdir. This patch replaces the quit at the end of the script with a simple `exit 0`.
(PE-15435) Import detect_platform function from pe_repo
This patch imports the platform detection code from puppetlabs/puppetlabs-pe_repo@0cbc9af as a function called detect_platform. This code was originally extracted from the utlities library for use in pe_repo and sets the PLATFORM_NAME global variable commonly used by the support script. The new detect_platform function replaces prepare_platform from the utilities library.
(PE-15435) Add PLATFORM_EGREP to detect_platform
This patch adds the PLATFORM_EGREP variable to detect_platform. This variable is used by quite a few support script checks.
(PE-15435) Add PLATFORM_HOSTNAME to detect_platform
This patch imports logic for setting the PLATFORM_HOSTNAME and PLATFORM_HOSTNAME_SHORT variables from prepare_platform in the utilities library.
(PE-15435) Add PLATFORM_PACKAGING to detect_platform
This patch imports logic for setting the PLATFORM_PACKAGING variable from prepare_platform in the utilities library.
(PE-15435) Replace prepare_user with a uid check
The prepare_user function from the utilities library ensures that the script is running as root. This function has been replaced with a direct check at the beginning of the main section of the script.
(PE-15435) Copy is_package_installed from utilities
This patch adds the is_package_installed function from the utilities library which is used to detect various PE components.
(PE-15435) Remove unused logic from run_diagnostic
The run_diagnostic function contained logic to handle the IS_DEBUG environment variable and send output to a logfile. The support script has been hardcoded to set IS_DEBUG for many releases and has never properly handled logfiles. This commit removes the logic for IS_DEBUG and logfiles from the run_diagnostic function and removes the IS_DEBUG hardcoded value from the main script section.
(PE-15435) Copy is_noop from utilities
The is_noop function tests the IS_NOOP environment variable and can be used to disable run_diagnostic calls while still printing the commands that would be executed.
(PE-15435) Remove puppet_bin_dir function
This patch relaces all calls to puppet_bin_dir with the global PUPPET_BIN_DIR variable.
(PE-15435) Copy get_ini_field from utilities
This patch adds the get_ini_field function from the utilites library. This function is used to extract PuppetDB configuration.
(PE-15435) Remove utilities library
This commit removes the utilities library that was copied from the installer directory of enterprise-dist. The support script is now self-contained.
Merge pull request #3 from Sharpie/pe-15435-remove-utilities
(PE1-5435) Remove installer dependencies
(maint) Remove old nodes_listing diagnostic
This patch removes the nodes_listing diagnostic which queried the Rails dashboard for a .csv file containing node info. Starting with PE 3.7, this check has consistently failed and it is no longer relevant since the Rails dashboard was removed in PE 2015.2.0.
(maint) Skip template databases
This patch modifies the get_all_database_names function to omit databases that start with "template". The psql utility usually can't connect to these databases and there is no data stored in them so it just causes a command failure.
(maint) Declare excludes before use
This patch ensures the local variable excludes in the gather_enterprise_files function is declared before use. No change in functionality is caused by this change, but it does allow the script to be run under `set -u`, which flags use of undeclared variables as errors, for testing purposes.
(maint) Add default value for FILESYNC variable
This patch sets the default value for the FILESYNC variable to 'n'. This variable controls whether or not filesync data will be captured by the script.
(maint) Turn command checks into conditionals
This patch re-factors some execution checks of the form:
check && command
To:
if check; then
command
fi
There is no change in behavior, but this re-factoring makes testing easier as
legitimately failing checks no longer trip `set -eo pipefail`.(maint) Skip r10k diagnostics if no config file
This patch skips the r10k diagnostic check if /etc/puppetlabs/r10k/r10k.yaml is missing as r10k will just fail with an error message.
(maint) Skip activemq lsof check if no lsof
This patch skips the activemq lsof check if lsof isn't installed.
(maint) Increase timeout on console status check
The console can take longer than 5 seconds to compute an answer to the service status check. This patch increases the timeout for the curl command to 60 seconds from 5 seconds and adds a 5 second connection timeout.
This patch moves the timeout function from the section of the script that contains diagnostic checks to the section which contains generic utility functions.
(PE-15945) Only gather whitelisted config files
Prior to this patch, the gather_enterprise_files function used a tar pipe to copy /etc/puppetlabs into the support script output directory with a blacklist of exclusions. The problem with this approach is that sensitive material, such as SSL keys, can easily escape the blacklist due to lack of maintenance or users creating backup copies under /etc/puppetlabs. This patch re-factors the gather_enterprise_files function to run a plain copy on a whitelist of configuration files.
(PE-6731) Redact passwords from PE configuration
This patch adds a post-processing step to gather_enterprise_files which loops through the files collected looking for XML attributes and keys in JSON, YAML, HOCON, and INI files, which end with "password" and redacts the values.
Add a version number to the support script
This patch adds a SCRIPT_VERSION global to the support script that can be used to identify which version of the script has been executed based on log files and generated output.
This patch adds the '-u' flag to the date command which generates the TIMESTAMP variable. This causes the timestamp to be expressed in UTC which is easier to reason about.
Add hostname to archive filename
This patch adds the hostname, PLATFORM_HOSTNAME_SHORT, to the filename of the archive created by the support script. This addition helps differentiate support scripts gathered across several nodes in a PE installation.
Add metadata to support script output
This patch adds a write_metadata function which creates a metadata.json file in the root of the support script archive. Currently, this metadata file only stores the version of the script that produced the archive.
(maint) Copy agent state to enterprise/state
In the 2015.2.0 update, the archive location for the agent state directory was changed to enterprise/puppetserver_state leaving enterprise/state empty. This patch removes puppetserver_state and resumes using enterprise/state as the output is from the agent and doesn't have any connection with Puppet Server.
Ensure PLATFORM_HOSTNAME_SHORT uses one segment
This patch filters PLATFORM_HOSTNAME_SHORT through `cut -d. -f1` before flagging it as read-only to ensure that value represents the short hostname.
Update metadata.json for v1.0.0
This patch updates the metadata.json file for the 1.0.0 release by setting the version number, requirements, dependencies and supported operating systems.