Advertisement
Guest User

puppet-enterprise-installer

a guest
Mar 2nd, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 130.50 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. #==========================================================
  4. # Copyright @ 2014 Puppet Labs, LLC
  5. # Redistribution prohibited.
  6. # Address: 308 SW 2nd Ave., 5th Floor Portland, OR 97204
  7. # Phone: (877) 575-9775
  8. # Email: info@puppetlabs.com
  9. #
  10. # Please refer to the LICENSE.pdf file included
  11. # with the Puppet Enterprise distribution
  12. # for licensing information.
  13. #==========================================================
  14.  
  15. #===[ Summary ]=========================================================
  16.  
  17. # This program installs Puppet Enterprise. Run this file to start the
  18. # interactive installation or run with a "-h" option to display help.
  19.  
  20. #===[ Conventions ]=====================================================
  21.  
  22. # VARIABLES
  23. #
  24. # Variable names starting with "q_" are sanitized user answers to
  25. # questions asked by the `ask` function.
  26. #
  27. # Variable names starting with "t_" are transient variables for use
  28. # within a function. For example, "t_ask__name" is a transient variable
  29. # for storing a "name" within the "ask" function. This convention is
  30. # necessary because all POSIX sh variables are globals and there's no
  31. # way to localize the scope of variables to prevent functions from
  32. # stomping over each other's state.
  33. #
  34. # Variable names in all capital letters are globals that are
  35. # intentionally shared between different functions.
  36. #
  37. # This file can be sourced into a shell for use as a library.
  38.  
  39. #===[ Global Varables ]================================================
  40. CONSOLE_PORT_OPTIONS="443,3000,3001,3002,3003,3004,3005"
  41. SLES_10_REGEX="sles-10-(i386|x86_64)"
  42.  
  43. #===[ Functions ]=======================================================
  44.  
  45. # Enqueue vendor packages based on user's answers...
  46. enqueue_vendor_packages() {
  47.     # NONPORTABLE
  48.     if [ "y" = "${q_puppet_cloud_install?}" -o "y" = "${q_database_install?}" ]; then
  49.       case "${PLATFORM_NAME?}" in
  50.         amazon | centos | rhel | sles)
  51.           enqueue_package 'libxslt'
  52.           ;;
  53.         debian | ubuntu)
  54.           enqueue_package 'libxslt1.1'
  55.           ;;
  56.       esac
  57.     fi
  58.  
  59.     case "${PLATFORM_NAME?}" in
  60.       amazon | centos | rhel)
  61.         # pciutils are required for facter
  62.         enqueue_package 'pciutils'
  63.  
  64.         # zlib is required for ruby
  65.         enqueue_package 'zlib'
  66.  
  67.         enqueue_package 'which'
  68.         enqueue_package 'libxml2'
  69.         # dmidecode is required for facter, but not available on el4
  70.         case "${PLATFORM_RELEASE}" in
  71.           6)
  72.             enqueue_package 'dmidecode'
  73.             enqueue_package 'cronie'
  74.             ;;
  75.           5)
  76.             enqueue_package 'dmidecode'
  77.             enqueue_package 'vixie-cron'
  78.             ;;
  79.         esac
  80.  
  81.         enqueue_package 'net-tools'
  82.         if [ y = "${q_puppetmaster_install?}" -o y = "${q_puppetdb_install?}" ]; then
  83.           enqueue_package 'libjpeg'
  84.         fi
  85.  
  86.         if [ y = "${q_puppetmaster_install?}" -o y = "${q_puppet_enterpriseconsole_install?}" ]; then
  87.           enqueue_package 'curl'
  88.           enqueue_package 'system-logos'
  89.           # JJM mailcap is required for /etc/mime.types
  90.           # In both RHEL x5 and x6
  91.           enqueue_package 'mailcap'
  92.         fi
  93.         ;;
  94.       sles)
  95.         # pciutils and pmtools are required for facter
  96.         if [ "${PLATFORM_RELEASE}" = "11" ] ; then
  97.             enqueue_package 'pmtools'
  98.         fi
  99.         enqueue_package 'pciutils'
  100.         enqueue_package 'cron'
  101.         enqueue_package 'net-tools'
  102.         enqueue_package 'libxml2'
  103.         if [ y = "${q_puppetmaster_install?}" -o y = "${q_puppetdb_install?}" ]; then
  104.             case "${PLATFORM_RELEASE}" in
  105.                 11)
  106.                   enqueue_package 'libjpeg'
  107.                   ;;
  108.                 12)
  109.                   enqueue_package 'libjpeg62'
  110.                   ;;
  111.               esac
  112.         fi
  113.  
  114.         if [ y = "${q_puppetmaster_install?}" -o y = "${q_puppet_enterpriseconsole_install?}" ]; then
  115.           enqueue_package 'libapr1'
  116.           enqueue_package 'curl'
  117.           enqueue_package 'libapr-util1'
  118.         fi
  119.         ;;
  120.       ubuntu | debian | cumulus)
  121.         # pciutils and dmidecode are required for facter, except on powerpc which has no dmidecode
  122.         enqueue_package 'pciutils'
  123.         if [ "${PLATFORM_NAME?}" = "ubuntu" ] || [ "${PLATFORM_NAME?}" = "debian" ] ; then
  124.             enqueue_package 'dmidecode'
  125.         fi
  126.  
  127.         enqueue_package 'hostname'
  128.         enqueue_package 'cron'
  129.         enqueue_package 'libldap-2.4-2'
  130.         enqueue_package 'libreadline5'
  131.         enqueue_package 'libxml2'
  132.  
  133.         if [ y = "${q_puppetmaster_install?}" -o y = "${q_puppetdb_install?}" ]; then
  134.           enqueue_package 'libjpeg62'
  135.         fi
  136.  
  137.         if [ y = "${q_puppetmaster_install?}" -o y = "${q_puppet_enterpriseconsole_install?}" ]; then
  138.           enqueue_package 'file'
  139.           enqueue_package 'libmagic1'
  140.           enqueue_package 'libpcre3'
  141.           enqueue_package 'curl'
  142.           enqueue_package 'perl'
  143.           enqueue_package 'mime-support'
  144.           enqueue_package 'libapr1'
  145.           enqueue_package 'libcap2'
  146.           enqueue_package 'libaprutil1'
  147.           if [ "${PLATFORM_NAME?}" = "ubuntu" ] || [ "${PLATFORM_NAME?}" = "debian" ] ; then
  148.             enqueue_package 'libaprutil1-dbd-sqlite3'
  149.             enqueue_package 'libaprutil1-ldap'
  150.           fi
  151.         fi
  152.         ;;
  153.       solaris)
  154.         if [ "${PLATFORM_RELEASE?}" = "11" ] ; then
  155.           enqueue_package 'system/library/gcc-45-runtime'
  156.           enqueue_package 'library/readline'
  157.           enqueue_package 'library/security/openssl'
  158.         fi
  159.         # There are no vendor packages to install on Solaris 10
  160.         ;;
  161.       aix | eos)
  162.         # No vendor packages
  163.         :
  164.         ;;
  165.       *)
  166.         display_failure "Do not know how to install vendor packages on this platform."
  167.         ;;
  168.     esac
  169. }
  170.  
  171. # Install or upgrade all modules to /opt/puppet/share/puppet/modules
  172. #
  173. # Arguments: Whether it is an install or upgrade. Defaults to install
  174. install_puppet_modules() {
  175.     # Save our current working directory.
  176.     pushd "${INSTALLER_DIR}" &>/dev/null
  177.     local t_install_dir="$(pwd)"
  178.     t_module_target_dir="/opt/puppet/share/puppet/modules"
  179.     t_module_backup_file="/opt/puppet/share/puppet/module.upgrade.backup.tar"
  180.     if ! is_noop; then
  181.         pushd ${t_module_target_dir} &>/dev/null
  182.         if run_suppress_output "ls ${t_module_target_dir}/* &> /dev/null"; then
  183.             # Backup current modules for recovery
  184.             run_suppress_stdout "tar cf ${t_module_backup_file} ${t_module_target_dir}/*"
  185.  
  186.             # Check module whitelist
  187.             if [ -f "${t_install_dir?}/modules/whitelist_modules.txt" ] ; then
  188.                 t_whitelist_modules=$( cat "${t_install_dir?}/modules/whitelist_modules.txt" )
  189.             fi
  190.             t_remove_modules=`ls "${t_module_target_dir}"`
  191.             for t_whitelist_module in ${t_whitelist_modules} ;
  192.             do
  193.                 t_remove_modules=`echo ${t_remove_modules?} | sed "s/\b${t_whitelist_module?}\b//"`
  194.             done
  195.  
  196.             # Remove non-whitelist modules
  197.             for t_remove_module in ${t_remove_modules?} ;
  198.             do
  199.                 run_suppress_stdout "rm -rf ${t_remove_module?}"
  200.             done
  201.         fi
  202.         for module_pkg in $( cat "${t_install_dir?}/modules/install_modules.txt" );
  203.         do
  204.             if [ -e "${t_install_dir?}/modules/${module_pkg}"* ]; then
  205.                 cur_mod_pkg=`ls "${t_install_dir?}/modules/${module_pkg?}"*`
  206.                 # Install module
  207.                 # --force is present to ensure we overwrite modules we control
  208.                 run_suppress_stdout '/opt/puppet/bin/puppet module install "'"${cur_mod_pkg}"'" --force --ignore-dependencies --modulepath /opt/puppet/share/puppet/modules'
  209.             fi
  210.         done
  211.         # If there was a puppet-module symlink in ${PLATFORM_SYMLINK_TARGET}, remove it
  212.         run_suppress_output "rm -f ${PLATFORM_SYMLINK_TARGET}/puppet-module"
  213.  
  214.         # Pop back to $INSTALLER_DIR
  215.         popd &>/dev/null
  216.     fi
  217.     # Pop back to original $PWD
  218.     popd &>/dev/null
  219.     run_suppress_stdout "chown ${PLATFORM_PUPPET_USER}:${PLATFORM_PUPPET_GROUP} -R ${t_module_target_dir?}"
  220. }
  221.  
  222. # Copy puppet modules to /opt/puppet/share/installer/modules and make sure they
  223. # are readable to the world so that they can be served by a puppet fileserver
  224. # mount to compile masters. This will remove any existing modules in the
  225. # directory on upgrades.
  226. create_module_mount() {
  227.     run_suppress_stdout "rm -rf /opt/puppet/share/installer/modules"
  228.  
  229.     run_suppress_stdout "cp -R ${INSTALLER_DIR?}/modules /opt/puppet/share/installer/modules"
  230.  
  231.     run_suppress_stdout "chmod 0755 /opt/puppet/share/installer/modules"
  232. }
  233.  
  234. configure_postgresql_server() {
  235.     # For fresh installs in which case we're installing postgres, make shmmax
  236.     # big enough. For upgrades from 3.x, presumably everything is already
  237.     # working so we'll just leave it alone.
  238.     if ! is_upgrade; then
  239.         t_postgres_memory_mb="$(/opt/puppet/bin/facter memorysize_mb)"
  240.         t_postgres_shmmax_req="$((${t_postgres_memory_mb%.*} * 1024 * 1024 / 2))"
  241.         t_postgres_shmmax_avail="$(/sbin/sysctl kernel.shmmax | awk '{ printf $3 }')"
  242.  
  243.         # Set kernel.shmmax if it's less than half the available memory size
  244.         if [ "${t_postgres_shmmax_req?}" -gt ${t_postgres_shmmax_avail?} ]; then
  245.             export t_manage_kernel_shmmax='y'
  246.         fi
  247.     fi
  248.  
  249.     apply_template_manifest "postgresql_server.pp.erb"
  250. }
  251.  
  252. configure_puppetdb() {
  253.     display "Configuring puppetdb..."
  254.  
  255.     create_package_repo
  256.  
  257.     # Uses
  258.     #   t_puppetdb_java_args
  259.     apply_template_manifest "puppetdb.pp.erb"
  260.  
  261.     remove_package_repo
  262.  
  263.     display "PuppetDB configured."
  264. }
  265.  
  266. # Setup a package repo on the master for the platform we're currently installing on
  267. setup_package_repo() {
  268.     display_comment "Setting up package repository for ${PLATFORM_TAG}"
  269.  
  270.     # The pe_repo module wants to make a symlink to an extracted tarball, so we
  271.     # have to mimic the structure of an extracted tarball.
  272.     t_pe_repo_basename="puppet-enterprise-${PE_VERSION?}-${PLATFORM_TAG?}"
  273.     t_pe_repo_package_dir="/opt/puppet/packages/public/${t_pe_repo_basename?}/packages"
  274.     run "mkdir -p '${t_pe_repo_package_dir?}'"
  275.     run "cp -R '$(platform_package_dir)' '${t_pe_repo_package_dir?}'"
  276.  
  277.     # now mimic an extracted agent tarball, except have it symlink to the packages dir
  278.     # created above
  279.     t_pe_repo_agent_basename="${t_pe_repo_basename?}-agent"
  280.     t_pe_repo_agent_package_dir="/opt/puppet/packages/public/${t_pe_repo_agent_basename?}/agent_packages"
  281.     run "mkdir -p '${t_pe_repo_agent_package_dir?}'"
  282.  
  283.     # To prevent us from duplicating agent packages on the system, symlink the agent_packages dir to
  284.     # to the main packages dir for this platform.
  285.     # If this link already exists that means we're trying to rerun the installer
  286.     # on a failed upgrade so throw some -f at `ln` so that `ln` doesn't complain it already exists.
  287.     run "ln -fs '${t_pe_repo_package_dir?}/${PLATFORM_TAG?}' '${t_pe_repo_agent_package_dir?}/${PLATFORM_TAG?}'"
  288.  
  289.     # Apply the pe_repo class to generate the install bash scripts.
  290.     # Template uses:
  291.     # - t_pe_repo_puppet_class
  292.     # - q_tarball_server
  293.     export t_pe_repo_puppet_class="$(platform_puppet_class)"
  294.     apply_template_manifest "pe_repo.pp.erb"
  295. }
  296.  
  297. # Simple listing of cloud gems that get enqueued
  298. # on many platforms (EL5, EL6, SLES11, lucid, squeeze, precise, wheezy)
  299. #
  300. handle_cloud() {
  301.     enqueue_package 'pe-cloud-provisioner'
  302.     enqueue_package 'pe-cloud-provisioner-libs'
  303.     # This is now being enqueued for all el, sles, deb and ubuntu installs so is no longer needed here.
  304.     # enqueue_package 'pe-rubygem-net-ssh'
  305. }
  306.  
  307. # Enqueue installer environment
  308. enqueue_installer_packages() {
  309.     case "${PLATFORM_NAME?}" in
  310.         amazon | centos | rhel)
  311.             # zlib is required for ruby
  312.             enqueue_package 'zlib'
  313.             ;;
  314.     esac
  315.  
  316.     enqueue_package 'pe-ruby'
  317.     enqueue_package 'pe-bundler'
  318.     enqueue_package 'pe-installer'
  319. }
  320.  
  321. enqueue_agent_packages() {
  322.     case "${PLATFORM_NAME?}" in
  323.         amazon | centos | rhel | sles | ubuntu | debian | cumulus | eos)
  324.             t_el_4_regex="el-4-(i386|x86_64)"
  325.             if [[ $PLATFORM_TAG =~ ${t_el_4_regex?} ]] || [[ $PLATFORM_TAG =~ ${SLES_10_REGEX?} ]] || [ "${PLATFORM_TAG}" = "eos-4-i386" ]; then
  326.                 enqueue_package 'pe-puppet-enterprise-release'
  327.                 enqueue_package 'pe-libyaml'
  328.                 enqueue_package 'pe-virt-what'
  329.                 enqueue_package 'pe-ruby'
  330.                 enqueue_package 'pe-ruby-shadow'
  331.                 enqueue_package 'pe-ruby-stomp'
  332.                 enqueue_package 'pe-mcollective-common'
  333.                 enqueue_package 'pe-mcollective'
  334.                 enqueue_package 'pe-facter'
  335.                 enqueue_package 'pe-puppet'
  336.                 enqueue_package 'pe-augeas'
  337.                 enqueue_package 'pe-ruby-augeas'
  338.                 enqueue_package 'pe-hiera'
  339.                 enqueue_package 'pe-ruby-rgen'
  340.                 enqueue_package 'pe-rubygem-deep-merge'
  341.                 enqueue_package 'pe-openssl'
  342.             else
  343.                 enqueue_package 'pe-agent'
  344.             fi
  345.             # pe-ruby-ldap and pe-rubygem-net-ssh are not built for agent only installs
  346.             if [ "false" = "${CLIENT_ONLY?}" ]; then
  347.                 enqueue_package 'pe-ruby-ldap'
  348.                 enqueue_package 'pe-rubygem-net-ssh'
  349.             fi
  350.             ;;
  351.         aix)
  352.             enqueue_package 'pe-puppet-enterprise-release'
  353.             enqueue_package 'pe-augeas'
  354.             enqueue_package 'pe-libyaml'
  355.             enqueue_package 'pe-openssl'
  356.             enqueue_package 'pe-ruby'
  357.             enqueue_package 'pe-ruby-augeas'
  358.             enqueue_package 'pe-ruby-stomp'
  359.             enqueue_package 'pe-ruby-rgen'
  360.             enqueue_package 'pe-rubygem-deep-merge'
  361.             enqueue_package 'pe-hiera'
  362.             enqueue_package 'pe-facter'
  363.             enqueue_package 'pe-mcollective'
  364.             enqueue_package 'pe-mcollective-common'
  365.             enqueue_package 'pe-puppet'
  366.             ;;
  367.  
  368.         solaris)
  369.             case "${PLATFORM_RELEASE?}" in
  370.                 10)
  371.                     enqueue_package 'PUPpuppet-enterprise-release'
  372.                     enqueue_package 'PUPlibyaml'
  373.                     enqueue_package 'PUPruby'
  374.                     enqueue_package 'PUPopenssl'
  375.                     enqueue_package 'PUPstomp'
  376.                     enqueue_package 'PUPmcollective'
  377.                     enqueue_package 'PUPfacter'
  378.                     enqueue_package 'PUPpuppet'
  379.                     enqueue_package 'PUPhiera'
  380.                     enqueue_package 'PUPruby-augeas'
  381.                     enqueue_package 'PUPaugeas'
  382.                     enqueue_package 'PUPruby-rgen'
  383.                     enqueue_package 'PUPdeep-merge'
  384.                     ;;
  385.                 11)
  386.                     enqueue_package 'pe-puppet-enterprise-release'
  387.                     enqueue_package 'pe-augeas'
  388.                     enqueue_package 'pe-libyaml'
  389.                     enqueue_package 'pe-ruby'
  390.                     enqueue_package 'pe-ruby-shadow'
  391.                     enqueue_package 'pe-ruby-augeas'
  392.                     enqueue_package 'pe-stomp'
  393.                     enqueue_package 'pe-ruby-rgen'
  394.                     enqueue_package 'pe-deep-merge'
  395.                     enqueue_package 'pe-hiera'
  396.                     enqueue_package 'pe-facter'
  397.                     enqueue_package 'pe-mcollective'
  398.                     enqueue_package 'pe-puppet'
  399.                     ;;
  400.                 *)
  401.                     display_failure "Do not know how to install on Solaris ${PLATFORM_RELEASE}"
  402.                     ;;
  403.             esac
  404.             ;;
  405.         *)
  406.             display_failure "Do not know how to install Ruby or Puppet on this platform"
  407.             ;;
  408.     esac
  409. }
  410.  
  411. query_about_master_connectivity() {
  412.     t_qamc__msg="Puppet Master at '${q_puppetagent_server}:8140' could not be reached."
  413.  
  414.     # fail if the answer file tells us to
  415.     if [ 'y' == "${q_fail_on_unsuccessful_master_lookup}" ]; then
  416.         display_failure "${t_qamc__msg} Aborting installation as directed by answer file. Set 'q_fail_on_unsuccessful_master_lookup' to 'n' if installation should continue despite communication failures."
  417.     elif [ 'n' == "${q_fail_on_unsuccessful_master_lookup}" -a 'y' == "${IS_ANSWER_REQUIRED}" ]; then
  418.         break
  419.     fi
  420.  
  421.     ask q_continue_or_reenter_master_hostname "The installer couldn’t reach the puppet master server at ${q_puppetagent_server}. If this server name is correct, please check your DNS configuration to ensure the puppet master node can be reached by name, and make sure your firewall settings allow traffic on port 8140. Enter ‘r’ if you need to re-enter the puppet master’s name; otherwise, enter ‘c’ to continue." cr
  422.     if [ 'c' == "${q_continue_or_reenter_master_hostname}" ]; then
  423.         break
  424.     else
  425.         unset q_puppetagent_server
  426.         ask q_puppetagent_server "Puppet master hostname to connect to?" String 'puppet'
  427.     fi
  428.     unset q_continue_or_reenter_master_hostname
  429. }
  430.  
  431. cron_enable() {
  432.     case "${PLATFORM_NAME?}" in
  433.         amazon | centos | rhel | eos )
  434.             enable_service 'crond'
  435.             bounce_service 'crond'
  436.             ;;
  437.         debian | ubuntu | sles | cumulus)
  438.             enable_service 'cron'
  439.             bounce_service 'cron'
  440.             ;;
  441.         solaris)
  442.             run_suppress_stdout "/usr/sbin/svcadm enable svc:/system/cron:default"
  443.             ;;
  444.         aix)
  445.             if ! /usr/sbin/lsitab "cron" > /dev/null; then
  446.                 run_suppress_stdout '/usr/sbin/mkitab "cron:23456789:respawn:/usr/sbin/cron"'
  447.             fi
  448.             ;;
  449.     esac
  450. }
  451.  
  452. # Utility function to re-query the user regarding an unavailable
  453. # value for a database variable, e.g. a db name that is in use already
  454. # Ask twice, then fail.
  455. # Arguments:
  456. # 1. The value of the resource to check for
  457. # 2. A string, one of either "user" or "db" to flag *which* kind of resource to check
  458. # 3. The variable that the value should be assigned to
  459. # 4. An optional message string to display to the user in the ask message
  460. # 5. An optional failure message to display
  461. requery_db_resource_value() {
  462.     t_success="n"
  463.     t_count=0
  464.     t_value="${1?}"
  465.     t_type="${2?}"
  466.     t_variable="${3?}"
  467.     t_message="${4}"
  468.     t_fail_message="${5}"
  469.     while [ "n" = "${t_success}" ] && [ ${t_count} -lt 2 ] ; do
  470.         unset "${t_variable}"
  471.         if [ -z "${t_message}" ] ; then
  472.             ask ${t_variable} "The ${t_type} name (${t_value}) for this host already exists on the PostgreSQL server. Please enter an unused ${t_type} name?" String
  473.         else
  474.             ask ${t_variable} "${t_message}" String
  475.         fi
  476.         eval t_value="${!t_variable}"
  477.         if is_db_name_available "${t_value}" "${t_type}" ; then
  478.             t_success="y"
  479.         fi
  480.         t_count=$(($t_count + 1))
  481.     done
  482.     if [ "n" = "${t_success}" ] ; then
  483.         # We tried twice, and failed. Fail hard.
  484.         if [ -z "${t_fail_message}" ] ; then
  485.             display_failure "Unable to create the ${t_type} with the name ${t_value}, ${t_type} already exists on the PostgreSQL server."
  486.         else
  487.             display_failure "${t_fail_message}"
  488.         fi
  489.     fi
  490. }
  491.  
  492. # Wait for the database server to be up and running. This is used so that we
  493. # don't try to verify the database until the server is ready to accept
  494. # connections. This is only done on database installs. $1 is the number of
  495. # connection attempts to make. Returns 0 if the database is running, and 1 if
  496. # the maximum number of attempts is reached.
  497. wait_for_db() {
  498.     t_wait_for_db_max_retries="${1?}"
  499.     t_wait_for_db_tries=0
  500.  
  501.     while [ "${t_wait_for_db_tries?}" -lt "${t_wait_for_db_max_retries?}" ]; do
  502.         if eval "su - ${q_database_root_user} -c \"${t_path_to_psql?} --command='\l'\" -s /bin/bash" &> /dev/null; then
  503.             return 0
  504.         else
  505.             sleep 0.5
  506.             t_wait_for_db_tries=$(expr "${t_wait_for_db_tries?}" + 1)
  507.         fi
  508.     done
  509.  
  510.     return 1
  511. }
  512.  
  513. # Wait for a service to be up and running.
  514. # This is only done on all-in-one installs.
  515. # $1 is the url to attempt the connection.
  516. # $2 is the number of connection attempts to make.
  517. # Returns 0 if the database is running, and 1 if
  518. # the maximum number of attempts is reached.
  519. wait_for_service() {
  520.     t_wait_for_service_max_retries="${2?}"
  521.     t_wait_for_service_tries=0
  522.  
  523.     t_wait_for_service_url="${1?}"
  524.  
  525.     while [ "${t_wait_for_service_tries?}" -lt "${t_wait_for_service_max_retries?}" ]; do
  526.         run_suppress_stdout "curl --tlsv1 -s ${t_wait_for_service_url}"
  527.         t_contact_service_exit_status=$?
  528.         # These are both known SSL failures which mean the service is up and listening.
  529.         # Since we're not using any known certs, we expect to be able to connect and then have an SSL failure.
  530.         # 35     SSL connect error. The SSL handshaking failed.
  531.         # 60     Peer certificate cannot be authenticated with known CA certificates.
  532.         case $t_contact_service_exit_status in
  533.             35 | 60)
  534.                 return 0
  535.                 ;;
  536.             *)
  537.                 sleep 1
  538.                 t_wait_for_service_tries=$(expr "${t_wait_for_service_tries?}" + 1)
  539.                 ;;
  540.         esac
  541.     done
  542.  
  543.     return 1
  544. }
  545.  
  546. # Wait for Node Classifier to be up and running.
  547. # This is only done on all-in-one installs.
  548. # $1 is the url to attempt the connection.
  549. # $2 is the number of connection attempts to make.
  550. # Returns 0 if the database is running, and 1 if
  551. # the maximum number of attempts is reached.
  552. wait_for_nc() {
  553.     t_wait_for_service_max_retries="${2?}"
  554.     t_wait_for_service_tries=0
  555.  
  556.     t_wait_for_service_url="${1?}"
  557.  
  558.     while [ "${t_wait_for_service_tries?}" -lt "${t_wait_for_service_max_retries?}" ]; do
  559.         # We grep for that specific string because when that endpoint returns an actual
  560.         # date for last updated, we can be sure that the Node Classifier will have classes available
  561.         # If last update is null, that means there are no classes in the NC.
  562.         if run_suppress_stdout "curl --tlsv1 -s --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem --key /opt/puppet/share/puppet-dashboard/certs/${q_puppetagent_certname}.private_key.pem --cert /opt/puppet/share/puppet-dashboard/certs/${q_puppetagent_certname}.cert.pem ${t_wait_for_service_url}/v1/last-class-update | grep -q last_update.*[[:digit:]]"; then
  563.             return 0
  564.         else
  565.             sleep 3
  566.             t_wait_for_service_tries=$(expr "${t_wait_for_service_tries?}" + 1)
  567.         fi
  568.     done
  569.  
  570.     return 1
  571. }
  572.  
  573. # Verify a single database on the database server.
  574. # The arguments to this function are the database, username, and password to
  575. # verify.
  576. verify_single_database() {
  577.     t_verify_database="${1?}"
  578.     t_verify_user="${2?}"
  579.     t_verify_password="${3?}"
  580.  
  581.     create_db_encoding="ENCODING 'utf8' LC_CTYPE 'en_US.utf8' LC_COLLATE 'en_US.utf8' template template0"
  582.     t_psql_remote_string="--host='${q_database_host?}' --port=${q_database_port?}"
  583.  
  584.     t_db_setup=0
  585.  
  586.     if ! output=$(run "PGPASSWORD='${t_verify_password?}' ${t_path_to_psql?} --username='${t_verify_user?}' ${t_psql_remote_string} --dbname='${t_verify_database?}' --command='\dT' 2>&1"); then
  587.         if echo $output | $PLATFORM_EGREP -q "role \"${t_verify_user?}\" does not exist" ; then
  588.             echo "Could not connect to the postgresql server using the user: ${t_verify_user?}. Please log in as a privileged user and set it up manually. Example SQL commands:" | display_wrapped_text
  589.             display_newline
  590.             printf -- '%s' "
  591.            CREATE USER \"${t_verify_user}\" PASSWORD '${t_verify_password?}';
  592.            "
  593.         elif echo $output | $PLATFORM_EGREP -q "database \"${t_verify_database?}\" does not exist" ; then
  594.             echo "Could not connect to postgresql server using database: ${t_verify_database?} with user: ${t_verify_user?}. Please log in as a privileged user and set it up manually. Example SQL commands:" | display_wrapped_text
  595.             display_newline
  596.             printf -- '%s' "
  597.            CREATE DATABASE \"${t_verify_database}\" OWNER \"${t_verify_user}\" ${create_db_encoding?};
  598.            "
  599.         else
  600.             echo "Could not connect to postgres server using the user: ${t_verify_user?} and database: ${t_verify_database?}. Please log in as a privileged user and set up the user or database manually. Example SQL commands:" | display_wrapped_text
  601.             display_newline
  602.             printf -- '%s' "
  603.            CREATE USER \"${t_verify_user}\" PASSWORD '${t_verify_password?}';
  604.            CREATE DATABASE \"${t_verify_database}\" OWNER \"${t_verify_user}\" ${create_db_encoding?};
  605.            "
  606.         fi
  607.         display_newline
  608.  
  609.         t_db_setup=1
  610.     else
  611.         display_comment "Database ${t_verify_database} verified successfully."
  612.     fi
  613. }
  614.  
  615. # verify_postgresql: there are two basic cases
  616. # 1) we are verifying a root user
  617. # 2) we are verifying existing credentials and databases
  618. #
  619. # The first and only argument represents which databases to verify: console,
  620. # puppetdb, classifier, activity, rbac, or some comma delimited subset thereof.
  621. #
  622. # The function uses several installer variables including:
  623. # - q_database_install
  624. # - q_database_host
  625. # - q_database_port
  626. # - q_database_root_user
  627. # - q_puppet_enterpriseconsole_database_name
  628. # - q_puppet_enterpriseconsole_database_user
  629. # - q_puppet_enterpriseconsole_database_password
  630. # - q_puppetdb_database_name
  631. # - q_puppetdb_database_user
  632. # - q_puppetdb_database_password
  633. # - q_activity_database_name
  634. # - q_activity_database_user
  635. # - q_activity_database_password
  636. # - q_classifier_database_name
  637. # - q_classifier_database_user
  638. # - q_classifier_database_password
  639. # - q_rbac_database_name
  640. # - q_rbac_database_user
  641. # - q_rbac_database_password
  642. # - t_path_to_psql
  643. #
  644. # It returns 0 for success if the databases/users exist or the root account is valid
  645. # and non-zero for failure if those databases/users don't exist or the root account is invalid
  646.  
  647. verify_postgresql() {
  648.     t_db_setup=0
  649.  
  650.     # If we are doing the setup, we need to verify that the root account credentials are good.
  651.     if [ y = "${q_database_install?}" ]; then
  652.         if ! eval "su - ${q_database_root_user} -c \"${t_path_to_psql?} --command='\l'\" -s /bin/bash" &> /dev/null; then
  653.             display_failure "Could not connect to the postgresql server using the ${q_database_root_user} user."
  654.         fi
  655.     else
  656.         t_psql_remote_string="--host='${q_database_host?}' --port=${q_database_port?}"
  657.  
  658.         # If we aren't doing the setup, we need to verify that the console and PuppetDB account credentials are good and the databases exist.
  659.         # We check each in turn and give example SQL commands for each block upon failure. We don't fail hard on error until the function returns,
  660.         # so all five blocks can display errors to the user.
  661.  
  662.         # First we check that the console user exists and that we can connect to the console database using the console user credentials.
  663.         if [ "${1?}" != "${1/console,/match/}" ]; then
  664.             if ! verify_single_database "${q_puppet_enterpriseconsole_database_name?}" "${q_puppet_enterpriseconsole_database_user?}" "${q_puppet_enterpriseconsole_database_password?}"; then
  665.                 t_db_setup=1
  666.             fi
  667.         fi
  668.  
  669.         if [ "${1?}" != "${1/puppetdb,/match}" ]; then
  670.             if ! verify_single_database "${q_puppetdb_database_name?}" "${q_puppetdb_database_user?}" "${q_puppetdb_database_password?}"; then
  671.                 t_db_setup=1
  672.             fi
  673.  
  674.             # Verify pg_trgm extension is created (PE-6859)
  675.             if output=$(run "PGPASSWORD='${q_puppetdb_database_password?}' ${t_path_to_psql?} --username='${q_puppetdb_database_user?}' ${t_psql_remote_string} --dbname='${q_puppetdb_database_name?}' --command='\dx pg_trgm' 2>&1"); then
  676.                 if echo "${output?}" | grep -q "pg_trgm.*|" ; then
  677.                     display_comment "Database ${q_puppetdb_database_name} pg_trgm extension verified."
  678.                 else
  679.                     display_error "Database ${q_puppetdb_database_name} pg_trgm extension could not be found. Please install pg_trgm."
  680.                     t_db_setup=1
  681.                 fi
  682.             fi
  683.         fi
  684.  
  685.         if [ "${1?}" != "${1/activity,/match}" ]; then
  686.             if ! verify_single_database "${q_activity_database_name?}" "${q_activity_database_user?}" "${q_activity_database_password?}"; then
  687.                 t_db_setup=1
  688.             fi
  689.         fi
  690.  
  691.         if [ "${1?}" != "${1/classifier,/match}" ]; then
  692.             if ! verify_single_database "${q_classifier_database_name?}" "${q_classifier_database_user?}" "${q_classifier_database_password?}"; then
  693.                 t_db_setup=1
  694.             fi
  695.         fi
  696.  
  697.         if [ "${1?}" != "${1/rbac,/match}" ]; then
  698.             if ! verify_single_database "${q_rbac_database_name?}" "${q_rbac_database_user?}" "${q_rbac_database_password?}"; then
  699.                 t_db_setup=1
  700.             fi
  701.  
  702.             # Verify citext extension is created (PE-6859)
  703.             if output=$(run "PGPASSWORD='${q_rbac_database_password?}' ${t_path_to_psql?} --username='${q_rbac_database_user?}' ${t_psql_remote_string} --dbname='${q_rbac_database_name?}' --command='\dx citext' 2>&1"); then
  704.                 if echo "${output?}" | grep -q "citext.*|" ; then
  705.                     display_comment "Database ${q_rbac_database_name} citext extension verified."
  706.                 else
  707.                     display_error "Database ${q_rbac_database_name} citext extension could not be found. Please install citext."
  708.                     t_db_setup=1
  709.                 fi
  710.             fi
  711.         fi
  712.     fi
  713.  
  714.     return ${t_db_setup?}
  715. }
  716.  
  717. # Verify the db credentials, as well as the console db if we're installing the
  718. # console.
  719. verify_db() {
  720.     t_verify_dbs=''
  721.     display_comment "Verifying postgresql credentials..."
  722.  
  723.     if ! is_upgrade && [ y = "${q_puppetdb_install?}" ]; then
  724.         t_verify_dbs='puppetdb,'
  725.     fi
  726.  
  727.     if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  728.         # If upgrading, we should only verify the new databases for 3.7 because
  729.         # we can assume the existing console/puppetdb is working.
  730.         if is_upgrade && [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ]; then
  731.             t_verify_dbs="${t_verify_dbs} rbac, classifier, activity,"
  732.         elif ! is_upgrade; then
  733.             t_verify_dbs="${t_verify_dbs} console, rbac, classifier, activity,"
  734.         fi
  735.     fi
  736.  
  737.     if ! verify_postgresql "${t_verify_dbs?}"; then
  738.         display_failure "The provided postgresql instance could not be verified. Please follow the above instructions and try again."
  739.     fi
  740. }
  741.  
  742. # Warn about needed open ports
  743. warn_open_ports() {
  744.     t_inbound_port_string=""
  745.     t_outbound_port_string=""
  746.  
  747.     # Add 443 for HTTPS connections if the console is being installed...
  748.     # Also 4433 for HTTPS connections if the classifier is being installed...
  749.     # Also 4435 for HTTPS connections if the dashboard is being installed...
  750.     # ... inbound if it's a console install...
  751.     if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  752.       t_inbound_port_string="${t_inbound_port_string?}${q_puppet_enterpriseconsole_httpd_port?}, 4433, 4435, "
  753.     elif [ y = "${q_puppetmaster_install?}" ]; then
  754.       t_outbound_port_string="${t_outbound_port_string?}4433, 4435, "
  755.     fi
  756.  
  757.     # Add 8140 for the puppetmaster and 61613 for mcollective/stomp/activemq...
  758.     # ... inbound if it's a master install...
  759.     if [ y = "${q_puppetmaster_install?}" ]; then
  760.       t_inbound_port_string="${t_inbound_port_string?}8140, 61613, "
  761.     else
  762.       # ... otherwise outbound
  763.       t_outbound_port_string="${t_outbound_port_string?}8140, 61613, "
  764.     fi
  765.  
  766.     # Add 5432 for Postgres...
  767.     # ... inbound if it's a non-console database install...
  768.     if [ y = "${q_database_install?}" -a ! y = "${q_puppet_enterpriseconsole_install?}" ]; then
  769.       t_inbound_port_string="${t_inbound_port_string?}${q_database_port?}, "
  770.     fi
  771.     # ... outbound on a non-database PuppetDB or console install
  772.     if [ ! y = "${q_database_install?}" ] && [ y = "${q_puppetdb_install}" -o y = "${q_puppet_enterpriseconsole_install}" ]; then
  773.       t_outbound_port_string="${t_outbound_port_string?}${q_database_port?}, "
  774.     fi
  775.  
  776.     # Add 8081 for PuppetDB if not a standalone install...
  777.     if [ ! y = "${q_all_in_one_install?}" ]; then
  778.       # ... inbound if it's a PuppetDB install
  779.       if [ y = "${q_puppetdb_install?}" ]; then
  780.         t_inbound_port_string="${t_inbound_port_string?}${q_puppetdb_port?}, "
  781.       fi
  782.       # ... outbound if it's a puppetmaster or console install
  783.       if [ y = "${q_puppetmaster_install}" ]; then
  784.         t_outbound_port_string="${t_outbound_port_string?}${q_puppetdb_port?}, "
  785.       fi
  786.     fi
  787.  
  788.     if [ -n "${t_inbound_port_string?}" ]; then
  789.         echo "If you have a firewall running, please ensure the following TCP ports are open: ${t_inbound_port_string%, }" | display_wrapped_text
  790.         display_newline
  791.     fi
  792.  
  793.     if [ -n "${t_outbound_port_string?}" ]; then
  794.         echo "If you have a firewall running, please ensure outbound connections are allowed to the following TCP ports: ${t_outbound_port_string%, }" | display_wrapped_text
  795.         display_newline
  796.     fi
  797.  
  798. }
  799.  
  800. #===[ Main ]============================================================
  801.  
  802. . "$(dirname "${0?}")/utilities"
  803.  
  804. # Version variables to use when creating links and printing messages.
  805. PE_VERSION=$(cat "$(dirname "${0?}")/VERSION" 2> /dev/null)
  806. PE_LINK_VER=$(echo ${PE_VERSION?} | cut -d '.' -f1,2)
  807.  
  808. if [ "puppet-enterprise-installer" = "$(basename "${0?}")" ]; then
  809.  
  810.     #---[ Environment ]-----------------------------------------------------
  811.  
  812.     # Installing via sudo may not add required path components
  813.     PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
  814.  
  815.     #---[ Paranoia ]--------------------------------------------------------
  816.  
  817.     # Exit immediately if a simple command exits with a non-zero status:
  818.     set -e
  819.  
  820.     #---[ Prepare ]---------------------------------------------------------
  821.  
  822.     # Catch CTRL-C and "set -e" errors:
  823.     register_exception_handler
  824.  
  825.     # Setup "PLATFORM_*" variables:
  826.     prepare_platform
  827.  
  828.     #---[ Process command-line options ]------------------------------------
  829.  
  830.     ANSWER_FILE_TO_LOAD=
  831.     ANSWER_FILE_TO_SAVE=
  832.     IS_ANSWER_REQUIRED=n
  833.     LOGFILE=
  834.     IS_NOOP=n
  835.     IS_DEBUG=n
  836.     IS_VERBOSE_DEBUG=n
  837.     IS_SAVE_ANSWERS=n
  838.     IS_SUPPRESS_OUTPUT=n
  839.     export IS_UPGRADE=n
  840.  
  841.     while getopts a:A:Dhl:nqs:V name; do
  842.         case "$name" in
  843.             a)
  844.                 ANSWER_FILE_TO_LOAD="${OPTARG?}"
  845.                 IS_ANSWER_REQUIRED=y
  846.                 ;;
  847.             A)
  848.                 ANSWER_FILE_TO_LOAD="${OPTARG?}"
  849.                 IS_ANSWER_REQUIRED=n
  850.                 ;;
  851.             D)
  852.                 IS_DEBUG=y
  853.                 ;;
  854.             h)
  855.                 display_header
  856.                 display_usage
  857.                 ;;
  858.             l)
  859.                 LOGFILE="${OPTARG?}"
  860.                 ;;
  861.             n)
  862.                 IS_NOOP=y
  863.                 ;;
  864.             q)
  865.                 IS_SUPPRESS_OUTPUT=y
  866.                 ;;
  867.             s)
  868.                 ANSWER_FILE_TO_SAVE="${OPTARG?}"
  869.                 IS_SAVE_ANSWERS=y
  870.                 ;;
  871.             V)
  872.                 IS_VERBOSE_DEBUG=y
  873.                 ;;
  874.             ?)
  875.                 display_header
  876.                 display_usage "Illegal option specified"
  877.                 ;;
  878.         esac
  879.     done
  880.  
  881.     #---[ Announce installation ]-------------------------------------------
  882.  
  883.      # Enforce quiet mode if specified
  884.      if is_quiet ; then
  885.        run_quiet_mode
  886.      fi
  887.  
  888.     # Enforce very verbose debugging if specified
  889.     is_verbose_debug
  890.  
  891.     # Announce installer:
  892.     display_header
  893.  
  894.     # Set umask to 0022. This is in a subshell and inside a conditional, so this umask will only
  895.     # persist for the run of the installer.
  896.     umask 0022
  897.  
  898.     # Prepare the installer variable:
  899.     installer_dir > /dev/null
  900.  
  901.     [ -s $(installer_dir)/VERSION ] || display_failure "The VERSION file seems to be missing from your installer. The installer cannot proceed without it."
  902.  
  903.     # Check if we are on a supported platform
  904.     if [ ${IS_SAVE_ANSWERS} != y ]; then
  905.       platform_support_check
  906.     fi
  907.  
  908.     # Check user:
  909.     prepare_user
  910.  
  911.     # Load answers if specified:
  912.     if [ ! -z "${ANSWER_FILE_TO_LOAD?}" ]; then
  913.         load_answers "${ANSWER_FILE_TO_LOAD?}"
  914.  
  915.         # Backward compatibility with answers from PE <= 1.2.x
  916.         convert_answers
  917.     fi
  918.  
  919.     # Prepare log file:
  920.     if ( ! is_save_answers ) && ( ! is_noop ) ; then
  921.         prepare_log_file "install"
  922.     fi
  923.  
  924.     # PE-537 without libgcc_s.so.1, our compiled software will not run.
  925.     solaris_re='solaris-10-(i386|sparc)'
  926.     if [[ "${PLATFORM_TAG}" =~ $solaris_re ]] && ( ! is_package_installed "SUNWgccruntime" ); then
  927.         display_failure "SUNWgccruntime provides /usr/sfw/lib/libgcc_s.so.1, which is required for Puppet Enterprise, please install the package from your Solaris installation media and run ${0} again."
  928.     fi
  929.  
  930.     # Check if we are working on a system that already has an install
  931.     if ( ! is_save_answers ) && [ -x /opt/puppet/bin/puppet ]; then
  932.         export IS_UPGRADE=y
  933.  
  934.         CURRENT_PE_BUILD=$(/opt/puppet/bin/puppet --version | cut -d' ' -f4 | cut -d')' -f1)
  935.         CURRENT_PE_VERSION=${CURRENT_PE_BUILD%%-*}
  936.         export CURRENT_PE_MAJOR=$(echo $CURRENT_PE_VERSION | cut -d'.' -f1)
  937.         export CURRENT_PE_MINOR=$(echo $CURRENT_PE_VERSION | cut -d'.' -f2)
  938.         CURRENT_PE_INCR=$(echo $CURRENT_PE_VERSION | cut -d'.' -f3)
  939.  
  940.         if [ "${CURRENT_PE_BUILD?}" = "${PE_VERSION?}" ]; then
  941.             display_newline
  942.             display " === Puppet-Enterprise version ${CURRENT_PE_BUILD?} already installed === "
  943.             display_newline
  944.             quit
  945.         else
  946.             display_newline
  947.             display " === Upgrade from version ${CURRENT_PE_BUILD?} detected === "
  948.             display_newline
  949.         fi
  950.  
  951.         # Fail if the current installed version is less than PE 3.3.2
  952.         t_el_4_regex="el-4-(i386|x86_64)"
  953.         if ([[ ! "$PLATFORM_TAG" =~ ${t_el_4_regex?} ]] && [ "$(echo_vercmp 3.3.2 $CURRENT_PE_VERSION)" = "1" ]); then
  954.             display_failure "In order to upgrade to ${PE_VERSION}, you must be running PE 3.3.2 or higher. However, for the best upgrade experience, we recommend upgrading from the latest 3.3.x release (http://puppetlabs.com/misc/pe-files/previous-releases). Once you have upgraded to 3.3.x, you can complete the upgrade to ${PE_VERSION}. For more information, see http://docs.puppetlabs.com/pe/3.7/install_upgrading.html."
  955.         elif ([[ "$PLATFORM_TAG" =~ ${t_el_4_regex?} ]] && [ "$(echo_vercmp 2.0.3 $CURRENT_PE_VERSION)" = "1" ]); then
  956.           display_failure "In order to upgrade to ${PE_VERSION} on EL4, you must first be running PE 2.0.3. To complete the upgrade to ${PE_VERSION}, you need to download and install the 2.0.3 release (http://puppetlabs.com/misc/pe-files/previous-releases). For more information, see http://docs.puppetlabs.com/pe/2.0/install_upgrading.html. Once you have updated to 2.0.3, you can complete the upgrade to ${PE_VERSION}."
  957.         fi
  958.  
  959.         # Check if this is an Enterprise Readiness Guide deployment (as opposed
  960.         # to a stock install). If so, bail out because we can't automatically
  961.         # upgrade.
  962.         if [ -e "/etc/puppetlabs/installer/details.txt" ]; then
  963.             display_failure "Your current version of Puppet Enterprise cannot be automatically upgraded because it uses a non-standard deployment and/or configuration. Please contact Puppet Labs support for assistance with your upgrade."
  964.         fi
  965.  
  966.         q_puppetagent_install=y
  967.  
  968.         q_puppetagent_certname="$(/opt/puppet/bin/puppet agent --configprint certname)"
  969.         q_puppetagent_server="$(/opt/puppet/bin/puppet agent --configprint server)"
  970.  
  971.         if is_cloud_provisioner; then
  972.             q_puppet_cloud_install='y'
  973.         else
  974.             q_puppet_cloud_install='n'
  975.         fi
  976.  
  977.         if is_puppetmaster; then
  978.             q_puppetmaster_install='y'
  979.             q_puppetmaster_certname="$(/opt/puppet/bin/puppet master --configprint certname)"
  980.             t_puppetmaster_node_terminus="$(get_ini_field '/etc/puppetlabs/puppet/puppet.conf' 'node_terminus')"
  981.             t_puppetmaster_external_node="$(get_ini_field '/etc/puppetlabs/puppet/puppet.conf' 'external_nodes')"
  982.  
  983.             export t_puppetserver_java_args="$(get_java_args "pe-puppetserver")"
  984.  
  985.             if [ "${t_puppetmaster_node_terminus}" == '' -o "${t_puppetmaster_node_terminus}" == 'console' -o "${t_puppetmaster_node_terminus}" == 'classifier' ] || [ "${t_puppetmaster_node_terminus}" == 'exec' -a "${t_puppetmaster_external_node}" == '/etc/puppetlabs/puppet-dashboard/external_node' ]; then
  986.                 q_puppetmaster_external_node_terminus=${q_puppetmaster_external_node_terminus:-"n"}
  987.             fi
  988.             #q_puppetca_install='y'
  989.  
  990.             extract_console_location_from_enc_script
  991.         else
  992.             q_puppetmaster_install='n'
  993.             #q_puppetca_install='n'
  994.         fi
  995.  
  996.         if is_console; then
  997.             q_puppet_enterpriseconsole_install='y'
  998.  
  999.             # In 3.7, puppetproxy.conf has the web port for the console and
  1000.             # puppetdashboard.conf has dashboard-specific vhosts. Prior to 3.7,
  1001.             # there was only puppetdashboard.conf and it held the web port.
  1002.             if [ -f '/etc/puppetlabs/httpd/conf.d/puppetproxy.conf' ]; then
  1003.                 t_console_httpd_port_file='/etc/puppetlabs/httpd/conf.d/puppetproxy.conf'
  1004.             else
  1005.                 t_console_httpd_port_file='/etc/puppetlabs/httpd/conf.d/puppetdashboard.conf'
  1006.             fi
  1007.  
  1008.             q_puppet_enterpriseconsole_httpd_port="${q_puppet_enterpriseconsole_httpd_port:-"$(${PLATFORM_EGREP} Listen ${t_console_httpd_port_file?} | sed -e 's/^\s*Listen [^:]*:\([[:digit:]]*\)\s*$/\1/')"}"
  1009.  
  1010.            if ! [[ "${q_puppet_enterpriseconsole_httpd_port?}" =~ ^[0-9]+$ ]]; then
  1011.                display_failure "Invalid console port '${q_puppet_enterpriseconsole_httpd_port?}': please make sure ${t_console_httpd_port_file?} does not contain extra vhost entries."
  1012.            fi
  1013.  
  1014.            # We transfer by default, but the user can override with an answer file.
  1015.            if [ "${CURRENT_PE_MAJOR?}" -eq "2" ]; then
  1016.                : ${q_database_transfer:='y'}
  1017.            else
  1018.                q_database_transfer='n'
  1019.            fi
  1020.  
  1021.            export t_console_services_java_args="$(get_java_args "pe-console-services")"
  1022.  
  1023.            q_puppet_enterpriseconsole_database_name=${q_puppet_enterpriseconsole_database_name:-"$(/opt/puppet/bin/ruby -ryaml -e "print YAML.load_file('/etc/puppetlabs/puppet-dashboard/database.yml')['common']['database']")"}
  1024.            q_puppet_enterpriseconsole_database_user=${q_puppet_enterpriseconsole_database_user:-"$(/opt/puppet/bin/ruby -ryaml -e "print YAML.load_file('/etc/puppetlabs/puppet-dashboard/database.yml')['common']['username']")"}
  1025.            q_puppet_enterpriseconsole_database_password=${q_puppet_enterpriseconsole_database_password:-"$(/opt/puppet/bin/ruby -ryaml -e "print YAML.load_file('/etc/puppetlabs/puppet-dashboard/database.yml')['common']['password']")"}
  1026.            q_database_host=${q_database_host:-"$(/opt/puppet/bin/ruby -ryaml -e "print YAML.load_file('/etc/puppetlabs/puppet-dashboard/database.yml')['common']['host']")"}
  1027.            q_database_port=${q_database_port:-"$(/opt/puppet/bin/ruby -ryaml -e "print YAML.load_file('/etc/puppetlabs/puppet-dashboard/database.yml')['common']['port']")"}
  1028.  
  1029.            if [ -z "${q_puppet_enterpriseconsole_httpd_port}" ]; then
  1030.                display_failure "Could not determine the existing Puppet Enterprise console port"
  1031.            fi
  1032.        else
  1033.            q_puppet_enterpriseconsole_install='n'
  1034.        fi
  1035.  
  1036.        if is_puppetdb; then
  1037.            q_puppetdb_install='y'
  1038.  
  1039.            # If it's not installed, we have to ask if they want to move to
  1040.            # pe-postgres, so we can't just set this to no.
  1041.            if is_postgres; then
  1042.                q_database_install='y'
  1043.            fi
  1044.  
  1045.            q_puppetdb_plaintext_port="${q_puppetdb_plaintext_port:-"$(get_ini_field '/etc/puppetlabs/puppetdb/conf.d/jetty.ini' 'port')"}"
  1046.            q_puppetdb_hostname="${q_puppetdb_hostname:-$q_puppetagent_certname}"
  1047.            q_puppetdb_port="${q_puppetdb_port:-"$(get_ini_field '/etc/puppetlabs/puppetdb/conf.d/jetty.ini' 'ssl-port')"}"
  1048.            export t_puppetdb_java_args="$(get_java_args "pe-puppetdb")"
  1049.  
  1050.            t_main_database_subname="$(get_ini_field '/etc/puppetlabs/puppetdb/conf.d/database.ini' 'subname')"
  1051.            q_database_host="${q_database_host:-$(echo "${t_main_database_subname?}" | sed -e 's/\/\/\([^:][^:]*\):\([0-9][0-9]*\)\/\(\S*\)/\1/')}"
  1052.             q_database_port="${q_database_port:-$(echo "${t_main_database_subname?}" | sed -e 's/\/\/\([^:][^:]*\):\([0-9][0-9]*\)\/\(\S*\)/\2/')}"
  1053.            q_puppetdb_database_name="${q_puppetdb_database_name:-$(echo "${t_main_database_subname?}" | sed -e 's/\/\/\([^:][^:]*\):\([0-9][0-9]*\)\/\(\S*\)/\3/')}"
  1054.  
  1055.             q_puppetdb_database_user="${q_puppetdb_database_user:-$(get_ini_field '/etc/puppetlabs/puppetdb/conf.d/database.ini' 'username')}"
  1056.             q_puppetdb_database_password="${q_puppetdb_database_password:-$(get_ini_field '/etc/puppetlabs/puppetdb/conf.d/database.ini' 'password')}"
  1057.  
  1058.         else
  1059.             # This could be changed later during the all-in-one check.
  1060.             q_puppetdb_install='n'
  1061.  
  1062.             if is_puppetmaster; then
  1063.                 # Try to figure out where PuppetDB is from the puppetdb.conf file
  1064.                 if is_package_installed 'pe-puppetdb-terminus' && [ -e '/etc/puppetlabs/puppet/puppetdb.conf' ]; then
  1065.                     q_puppetdb_hostname=${q_puppetdb_hostname:-"$(get_ini_field '/etc/puppetlabs/puppet/puppetdb.conf' server)"}
  1066.                     q_puppetdb_port=${q_puppetdb_port:-"$(get_ini_field '/etc/puppetlabs/puppet/puppetdb.conf' port)"}
  1067.                 fi
  1068.             elif is_console; then
  1069.               # Try to figure out where PuppetDB is from the answers.install
  1070.               # file (if the user hasn't removed it). Although it is not an
  1071.               # INI file, it has the same field=value format, so the
  1072.               # `get_ini_field` helper function should be able to parse it
  1073.               # correctly.
  1074.               if [ -s '/etc/puppetlabs/installer/answers.install' ]; then
  1075.                 q_puppetdb_hostname=${q_puppetdb_hostname:-"$(get_ini_field '/etc/puppetlabs/installer/answers.install' q_puppetdb_hostname)"}
  1076.                 q_puppetdb_port=${q_puppetdb_port:-"$(get_ini_field '/etc/puppetlabs/installer/answers.install' q_puppetdb_port)"}
  1077.               fi
  1078.             fi
  1079.         fi
  1080.  
  1081.         if is_postgres; then
  1082.             q_database_shared_buffers="$(get_postgres_setting "shared_buffers")"
  1083.             q_database_maintenance_work_mem="$(get_postgres_setting 'maintenance_work_mem')"
  1084.             q_database_effective_cache_size="$(get_postgres_setting 'effective_cache_size')"
  1085.             q_database_wal_buffers="$(get_postgres_setting 'wal_buffers')"
  1086.             q_database_work_mem="$(get_postgres_setting 'work_mem')"
  1087.             q_database_checkpoint_segments="$(get_postgres_setting 'checkpoint_segments')"
  1088.             q_database_log_min_duration_statement="$(get_postgres_setting 'log_min_duration_statement')"
  1089.         fi
  1090.  
  1091.         # If we're a master and a console, we must be either a 2.x install (in
  1092.         # which case we get converted to all-in-one), or a 3.x all-in-one
  1093.         # install (which means we must already have puppetdb and the database).
  1094.         if is_puppetmaster && is_console; then
  1095.             q_all_in_one_install='y'
  1096.  
  1097.             q_puppetdb_install='y'
  1098.         else
  1099.             q_all_in_one_install='n'
  1100.         fi
  1101.  
  1102.         if is_console; then
  1103.             if [ "$(echo_vercmp 3.2.0 $CURRENT_PE_VERSION)" = "1" ] && [ "${CURRENT_PE_MAJOR?}" -eq "3" ]; then
  1104.                 display_comment "Collecting information..."
  1105.  
  1106.                 #If the current version is 3.x but less than 3.2.0 we'll be upgrading the database IDs within PostgreSQL from int to bigint.
  1107.                 #We try to analyze as much as we can depending on the PE configuration
  1108.                 t_current_largest_table_size=$(verbose_bundle_exec "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:console:current_largest_table_size RAILS_ENV=production" | tail -n 1)
  1109.  
  1110.                 t_extra_space_percent=20
  1111.  
  1112.                 #with 'set -e' the let command would fail if it returned zero...
  1113.                 if [ ${t_current_largest_table_size?} -gt 0 ]; then
  1114.                     let t_required_tablespace_free="${t_current_largest_table_size?}*(100+${t_extra_space_percent?})/100"
  1115.                 else
  1116.                     t_required_tablespace_free=1
  1117.                 fi
  1118.  
  1119.                 # q_database_install may not be set here in the case where it's
  1120.                 # not a database install (because we plan to ask later), so the
  1121.                 # answer is optional. But if it *is* a database, we know for
  1122.                 # sure, so it's safe.
  1123.                 if [ ! ${t_current_largest_table_size?} = "-1" ] && [ y = "${q_database_install}" ]; then
  1124.                     #This is the best case - we are on pe-postgres running on the local machine
  1125.                     t_current_tablespace_free=$(verbose_bundle_exec "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:console:current_tablespace_free RAILS_ENV=production" | tail -n 1)
  1126.  
  1127.                     if [ ! ${t_current_tablespace_free?} = "-1" ]; then
  1128.                         #This should always get here (free space should be known) unless there's something unexpected
  1129.                         if [ ${t_current_tablespace_free?} -lt ${t_required_tablespace_free?} ]; then
  1130.                             #We know that there is not enough space so we warn the user. We may be wrong though
  1131.                             #if the database has not been vacuumed regularly! User still has the chance to take the risk.
  1132.                             ask q_upgrade_with_low_disk_space "This upgrade requires an update to your database. To complete successfully, this database update temporarily requires at least ${t_required_tablespace_free?}MB of free disk space on the node providing the database role. Only ${t_current_tablespace_free?}MB of disk space appears to be available, so this upgrade may fail if you choose to continue! Continue anyway?" yN
  1133.  
  1134.                             if [ ! y = "${q_upgrade_with_low_disk_space?}" ]; then
  1135.                                 quit 1
  1136.                             fi
  1137.                         fi
  1138.                     fi
  1139.  
  1140.                 else
  1141.                     #The database is not local or it is not pe-postgres - we can't compute the free tablespace
  1142.                     t_current_tablespace_free="-1"
  1143.                 fi
  1144.  
  1145.                 if [ ${t_current_tablespace_free?} = "-1" ]; then
  1146.                     if [ ! ${t_current_largest_table_size?} = "-1" ]; then
  1147.                         #Since we are on pe-postgres we known how much free space we need but we can't compute how much we really have
  1148.                         ask q_upgrade_with_unknown_disk_space "This upgrade requires an update to your database. To complete successfully, this database update temporarily requires at least ${t_required_tablespace_free?}MB of free disk space on the node providing the database role. Is there at least ${t_required_tablespace_free?}MB of free disk space available?" yn
  1149.                     else
  1150.                         #Since we are not on pe-postgres we don't known how much free space we need, it's all user's reponsibility
  1151.                         ask q_upgrade_with_unknown_disk_space "This upgrade requires an update to your database. To complete successfully, this database update temporarily requires some free disk space on the node providing the database role. The space required is about ${t_extra_space_percent?}% larger than the size of the largest table currently in your database. Is this amount of free disk space available?" yn
  1152.                     fi
  1153.  
  1154.                     if [ ! y = "${q_upgrade_with_unknown_disk_space?}" ]; then
  1155.                         quit 1
  1156.                     fi
  1157.                 fi
  1158.             fi
  1159.         fi
  1160.  
  1161.         # If we're a master or console, we need to make sure to respect that
  1162.         # the user may have opted out of update checking. If they set it in an
  1163.         # answer file *now*, use that. Otherwise check if they set it in the
  1164.         # old answer file (if it's still around). Otherwise it's on by default.
  1165.         if (is_puppetmaster || is_console) && [ -s '/etc/puppetlabs/installer/answers.install' ]; then
  1166.             q_pe_check_for_updates=${q_pe_check_for_updates:-"$(get_ini_field '/etc/puppetlabs/installer/answers.install' q_pe_check_for_updates)"}
  1167.         fi
  1168.  
  1169.         if (is_puppetdb || is_console) && [ -s '/etc/puppetlabs/installer/answers.install' ]; then
  1170.             q_puppetmaster_certname="${q_puppetmaster_certname:-"$(get_ini_field '/etc/puppetlabs/installer/answers.install' 'q_puppetmaster_certname')"}"
  1171.         fi
  1172.     fi
  1173.  
  1174.     #---[ Support for installing in a symlinked opt dir ]--------------------
  1175.  
  1176.     if [ -L "/opt" ]; then
  1177.         case "${PLATFORM_NAME?}" in
  1178.             solaris)
  1179.                 declare -x PKG_NONABI_SYMLINKS='true'
  1180.                 ;;
  1181.         esac
  1182.     fi
  1183.  
  1184.     if ! is_upgrade && [ 'false' = "${CLIENT_ONLY?}" ]; then
  1185.         #---[ Interview user ]--------------------------------------------------
  1186.         if [ -z "${ANSWER_FILE_TO_LOAD?}" ]; then
  1187.             t_automated_install_doc_link="http://docs.puppetlabs.com/pe/${PE_LINK_VER?}/install_automated.html"
  1188.             t_answer_file_ref_doc_link="http://docs.puppetlabs.com/pe/${PE_LINK_VER?}/install_answer_file_reference.html"
  1189.             display_step 'GUIDED INSTALLATION' n
  1190.             display_newline
  1191.             display "Before you begin, choose an installation method. We've provided a few paths to choose from."
  1192.             display_newline
  1193.             echo "- Perform a guided installation using the web-based interface. Think of this as an installation interview in which we ask you exactly how you want to install PE. In order to use the web-based installer, you must be able to access this machine on port 3000 and provide the SSH credentials of a user with root access. This method will login to servers on your behalf, install Puppet Enterprise and get you up and running fairly quickly." | display_wrapped_text 0 0
  1194.             display_newline
  1195.             display_newline
  1196.             echo "- Use the web-based interface to create an answer file so that you login to the servers yourself and perform the installation locally. Refer to Answer File Installation (${t_automated_install_doc_link?}), which provides an overview on installing PE with an answer file." | display_wrapped_text 0 0
  1197.             display_newline
  1198.             display_newline
  1199.             echo "- If you choose not to use the web-based interface, you can write your own answer file or use the answer file(s) provided in the PE installation tarball. Check the Answer File Reference Overview (${t_answer_file_ref_doc_link?}) to get started." | display_wrapped_text 0 0
  1200.             display_newline
  1201.             display_newline
  1202.  
  1203.             ask q_packages_install "Install packages and perform a guided install?" Yn
  1204.  
  1205.             if [ 'y' = "${q_packages_install?}" ]; then
  1206.                 display_newline
  1207.                 display "Installing setup packages."
  1208.                 display_newline
  1209.  
  1210.                 enqueue_installer_packages
  1211.                 run_suppress_stdout install_queued_packages
  1212.  
  1213.                 # Copy the pe installer
  1214.                 t_installer_dest="/opt/puppet/share/installer/installer"
  1215.                 run "mkdir -p '${t_installer_dest?}'"
  1216.                 run "cp -pR '$(installer_dir)'/* '${t_installer_dest?}'"
  1217.  
  1218.                 # Start installer service
  1219.                 INSTALLER_SUPPORTED_PORTS="3000,4567"
  1220.                 INSTALLER_PORT=$(find_unused_tcp_port "${PLATFORM_HOSTNAME}" "${INSTALLER_SUPPORTED_PORTS}")
  1221.                 if [ "${INSTALLER_PORT}" != '' ]; then
  1222.                     echo "Please go to https://${PLATFORM_HOSTNAME}:${INSTALLER_PORT} in your browser to continue installation. Be sure to use https:// and that port ${INSTALLER_PORT?} is reachable through the firewall." | display_wrapped_text 0 0
  1223.                     display_newline
  1224.  
  1225.                     # This will block
  1226.                     pushd /opt/puppet/share/installer &>/dev/null
  1227.  
  1228.                     run_suppress_output "RACK_ENV=production /opt/puppet/bin/bundle exec thin start --debug -p ${INSTALLER_PORT} -a 0.0.0.0 --ssl --ssl-disable-verify"
  1229.  
  1230.                     popd &>/dev/null
  1231.  
  1232.                     display_newline
  1233.                     display "Your infrastructure has finished installing."
  1234.                     display "Thank you for installing Puppet Enterprise!"
  1235.                     quit 0
  1236.                 else
  1237.                     display_failure "Could not open a TCP port for web server. Tried ${INSTALLER_SUPPORTED_PORTS}."
  1238.                 fi
  1239.             else
  1240.                 display_newline
  1241.                 display_major_separator
  1242.                 display_newline
  1243.                 display "!! Installation cancelled"
  1244.                 display_newline
  1245.                 display_major_separator
  1246.                 quit 1
  1247.             fi
  1248.         fi
  1249.     fi
  1250.  
  1251.     display_step 'SELECT AND CONFIGURE ROLES' n
  1252.     display_newline
  1253.  
  1254.     if [ 'false' =  "${CLIENT_ONLY?}" ]; then
  1255.         echo "This installer lets you select and install the various roles required in a Puppet Enterprise deployment: puppet master, console, database, cloud provisioner, and puppet agent." | display_wrapped_text
  1256.         display_newline
  1257.         display_newline
  1258.  
  1259.         display "NOTE: when specifying hostnames during installation, use the fully-qualified domain name (foo.example.com) rather than a shortened name (foo)."
  1260.         display_newline
  1261.  
  1262.         display_product 'puppet master' "The puppet master serves configurations to a group of puppet agent nodes. This role also provides MCollective's message queue and client interface. It should be installed on a robust, dedicated server."
  1263.         ask q_puppetmaster_install 'Install puppet master?' yN
  1264.  
  1265.         if [ y = "${q_puppetmaster_install?}" ]; then
  1266.             display_product "standalone install" "You may choose to either install PuppetDB and the console on this node, or to install each service on its own node. If you choose not to install PuppetDB and the console on this node, you will be asked where to find them."
  1267.             ask q_all_in_one_install "Install PuppetDB and console on this node?" Yn
  1268.  
  1269.             # If all-in-one, then autoselect everything. If not all-in-one,
  1270.             # then deselect everything.
  1271.             if [ y = "${q_all_in_one_install?}" ]; then
  1272.                 q_puppetdb_install='y'
  1273.                 q_puppet_enterpriseconsole_install='y'
  1274.             else
  1275.                 q_puppetdb_install='n'
  1276.                 q_puppet_enterpriseconsole_install='n'
  1277.             fi
  1278.         else
  1279.             q_all_in_one_install=n
  1280.  
  1281.             ask q_puppetagent_server "Puppet master hostname to connect to?" String puppet
  1282.             if ( ! is_save_answers ) && [ 'n' = "${q_skip_master_verification:-"n"}" ] ; then
  1283.                 while ! tcp_port_in_use "${q_puppetagent_server}" 8140 ; do
  1284.                     query_about_master_connectivity
  1285.                 done
  1286.             fi
  1287.             :           ${q_fail_on_unsuccessful_master_lookup:='y'}
  1288.             :           ${q_puppetca_hostname:=${q_puppetagent_server?}}
  1289.         fi
  1290.  
  1291.         # If you're *not* installing a master, you can choose PuppetDB
  1292.         if [ ! y = "${q_puppetmaster_install?}" ]; then
  1293.             display_product 'database support' "This role provides database support for PuppetDB and PE's console. PuppetDB is a centralized data service that caches data generated by Puppet and provides access to it via a robust API. The console uses data provided by a PostgreSQL server and database both of which will be installed along with PuppetDB on the node you specify."
  1294.  
  1295.             echo "IMPORTANT: If you choose not to install PuppetDB at this time, you will be prompted for the host name of the node you intend to use to provide database services. Note that you must install database support on that node for the console to function. When using a separate node, you should install database support on it BEFORE installing the console role." | display_wrapped_text
  1296.             display_newline
  1297.             display_newline
  1298.  
  1299.             ask q_puppetdb_install 'Install PuppetDB?' yN
  1300.  
  1301.             # If you've chosen PuppetDB, you cannot choose console
  1302.             if [ y = "${q_puppetdb_install?}" ]; then
  1303.                 q_puppet_enterpriseconsole_install='n'
  1304.             fi
  1305.         fi
  1306.  
  1307.         if [ 'y' = "${q_puppetdb_install?}" ]; then
  1308.             :       ${q_puppetdb_plaintext_port:='8080'}
  1309.             :       ${q_puppetdb_port:='8081'}
  1310.  
  1311.             if ( ! is_save_answers ) && ( ! is_upgrade ); then
  1312.                 # Verify that ports 8080 and 8081 (or the port from the answer file) are available if this isn't answer-save mode.
  1313.                 for port in $q_puppetdb_plaintext_port $q_puppetdb_port; do
  1314.                     if tcp_port_in_use "127.0.0.1" $port ; then
  1315.                         display_newline
  1316.                         display_failure "Port $port appears to be in use. This port is required for PuppetDB. Please either move the services for this port to another or install on a system with this port available."
  1317.                     fi
  1318.                 done
  1319.             fi
  1320.         fi
  1321.  
  1322.         # If you're not installing master or PuppetDB, you can install console
  1323.         if [ ! y = "${q_puppetmaster_install?}" -a ! y = "${q_puppetdb_install?}" ]; then
  1324.             display_product 'console' "The console is a web interface where you can view reports, classify nodes, control Puppet runs, and invoke MCollective agents. It can be installed on the puppet master's node, but for performance considerations, especially in larger deployments, it can also be installed on a separate node."
  1325.             ask q_puppet_enterpriseconsole_install 'Install the console?' yN
  1326.             q_puppetca_install='n'
  1327.         fi
  1328.  
  1329.         # Verify that port 8140 is available if this isn't answer-save mode and we're not upgrading.
  1330.         if ( ! is_save_answers ) && ( ! is_upgrade ) && [ 'y' = "${q_puppetmaster_install?}" -o 'y' = "${q_puppet_enterpriseconsole_install?}" ] && tcp_port_in_use "127.0.0.1" 8140 ; then
  1331.             display_newline
  1332.             display_failure "Port 8140 appears to be in use. This port is required for the puppet master. Please either move the services for this port to another or install on a system with this port available."
  1333.         fi
  1334.  
  1335.         # Verify they haven't somehow chosen two out of three roles (such as
  1336.         # answer file). This shouldn't actually be possible, since we
  1337.         # automatically deselect roles during the interview, but better to be
  1338.         # safe than sorry.
  1339.         if [ y = "${q_puppetmaster_install?}" -a y = "${q_puppetdb_install?}" -a ! y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1340.             display_failure "You may not select the Puppet master and PuppetDB roles together without the console role. Please select either an all-in-one install or a single role."
  1341.         fi
  1342.  
  1343.         if [ y = "${q_puppetmaster_install?}" -a ! y = "${q_puppetdb_install?}" -a y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1344.             display_failure "You may not select the Puppet master and console roles together without the PuppetDB role. Please select either an all-in-one install or a single role."
  1345.         fi
  1346.  
  1347.         if [ ! y = "${q_puppetmaster_install?}" -a y = "${q_puppetdb_install?}" -a y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1348.             display_failure "You may not select the PuppetDB and console roles together without the Puppet master role. Please select either an all-in-one install or a single role."
  1349.         fi
  1350.  
  1351.         # If we're not installing PuppetDB, we probably need to know where it is.
  1352.         if [ ! y = "${q_puppetdb_install?}" ] && [ y = "${q_puppetmaster_install?}" -o y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1353.             if [ y = "${q_puppetmaster_install?}" ] && ! is_upgrade; then
  1354.                 display_newline
  1355.                 echo "Puppet Enterprise requires the installation of PuppetDB.  PuppetDB needs to be cleanly installed on a new node after the installation of the puppet master has successfully completed. Please provide the hostname and port for the node on which you will be installing PuppetDB." | display_wrapped_text
  1356.                 display_newline
  1357.                 display_newline
  1358.             fi
  1359.             ask q_puppetdb_hostname "Hostname for contacting PuppetDB?" String
  1360.             ask q_puppetdb_port "Port for contacting PuppetDB?" Port "8081"
  1361.             :       ${q_puppetdb_plaintext_port:='8080'}
  1362.         fi
  1363.  
  1364.         if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1365.             :                ${q_puppetmaster_enterpriseconsole_hostname:='127.0.0.1'}
  1366.         elif [ y = "${q_puppetmaster_install?}" ]; then
  1367.             if ! is_upgrade ; then
  1368.                 display_newline
  1369.                 echo "Puppet Enterprise requires the installation of the Console.  The Console needs to be cleanly installed on a new node after the installation of the puppet master has successfully completed. Please provide the hostname and port for the node on which you will be installing the Console." | display_wrapped_text
  1370.                 display_newline
  1371.                 display_newline
  1372.             fi
  1373.             ask q_puppetmaster_enterpriseconsole_hostname "Hostname for contacting the console?" String
  1374.             :                ${q_puppetmaster_enterpriseconsole_certname:="${q_puppetmaster_enterpriseconsole_hostname?}"}
  1375.        fi
  1376.  
  1377.        display_product 'cloud provisioner' 'The cloud provisioner can create and bootstrap new machine instances and add them to your Puppet infrastructure. It should be installed on a trusted node where site administrators have shell access.'
  1378.        ask q_puppet_cloud_install 'Install the cloud provisioner?' yN
  1379.  
  1380.        if [ y = "${q_puppetmaster_install?}" -o y = "${q_puppet_enterpriseconsole_install?}" -o y = "${q_puppetdb_install?}" -o y = "${q_puppet_cloud_install?}" ]; then
  1381.            q_puppetagent_install='y'
  1382.            display_product 'puppet agent' 'The puppet agent role is automatically installed with the console, puppet master, puppetdb, and cloud provisioner roles.'
  1383.        else
  1384.            display_product 'puppet agent' 'The puppet agent applies configurations from the puppet master and submits reports and inventory information. It should be installed on every node you plan to manage with Puppet.'
  1385.            ask q_puppetagent_install 'Install puppet agent?' Yn
  1386.        fi
  1387.  
  1388.        if [ y = "${q_puppetmaster_install?}" ]; then
  1389.            ask q_puppetmaster_certname "The puppet master's certificate will contain a unique name (\"certname\"); this should be the main DNS name at which it can be reliably reached. Puppet master's certname?" StringForceLowerCase "${PLATFORM_HOSTNAME?}" # The master's certname gets used as the filebucket server in site.pp. If it isn't a reachable DNS name, users have to edit site.pp post-install.
  1390.            # We only use alt names when generating the master's cert, so we
  1391.            # don't need them for upgrade
  1392.            if ! is_upgrade; then
  1393.                ask q_puppetmaster_dnsaltnames "The puppet master's certificate can contain DNS aliases; agent nodes will only trust the master if they reach it at its certname or one of these official aliases. Puppet master's DNS aliases (comma-separated list)?" StringDNSName "$(display_dnsaltnames "${q_puppetmaster_certname?}" "puppet")"
  1394.            fi
  1395.            display_newline
  1396.            :           ${q_puppetca_hostname:=${q_puppetmaster_certname?}}
  1397.        fi
  1398.  
  1399.        if [ y = "${q_puppetdb_install?}" -o y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1400.            if [ y = "${q_puppetdb_install?}" ]; then
  1401.                if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1402.                    t_main_database_products="The Puppet Enterprise console and PuppetDB"
  1403.                    t_main_database_verb="require"
  1404.                else
  1405.                    t_main_database_products="PuppetDB"
  1406.                    t_main_database_verb="requires"
  1407.                fi
  1408.  
  1409.                echo "${t_main_database_products?} ${t_main_database_verb?} a PostgreSQL database and a user account able to edit it. Puppet Enterprise includes a Postgresql server which you can install locally, or you can specify an existing remote database (which must be configured and available prior to installing the console or PuppetDB)." | display_wrapped_text
  1410.            elif [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1411.                echo "The Puppet Enterprise console requires a PostgreSQL database and a user account able to edit it. This database and the Puppet Enterprise PostgreSQL server are automatically installed and configured, along with PuppetDB, on a node you select for the database support role. You should install this role BEFORE installing the console role. After installing the database support role, you can find auto-generated passwords for the database user and the authentication database user in '/etc/puppetlabs/installer/database_info.install' on that node." | display_wrapped_text
  1412.            fi
  1413.            display_newline
  1414.            display_newline
  1415.        fi
  1416.  
  1417.        if [ y = "${q_puppetdb_install?}" ]; then
  1418.            ask q_database_install "Install the included Puppet Enterprise PostgreSQL server locally?" Yn
  1419.            # This variable represents whether or not we're using PE postgres,
  1420.            # independently of whether it's installed on this node. The main
  1421.            # purpose of the variable is to feed into the console install so we
  1422.            # know whether to classify the PuppetDB node with manage_database
  1423.            # true or false.
  1424.            q_pe_database="${q_database_install?}"
  1425.        else
  1426.            q_database_install='n'
  1427.        fi
  1428.  
  1429.        if [ y = "${q_database_install?}" ]; then
  1430.  
  1431.            if ! is_save_answers && ! is_upgrade && [ -x /opt/puppet/var/lib/pgsql ] && [ "y" != "${q_skip_backup}" ]; then
  1432.                display_newline
  1433.                display " === Existing Puppet Enterprise data detected === "
  1434.                display_newline
  1435.                display_comment "It looks like Puppet Enterprise had been installed on this machine and it was uninstalled without the purge data option (-d). The existing databases cannot be reused by this installer. You can either quit this installation or the installer can move your existing database directory to /opt/puppet/var/lib/pgsql.<yyyymmddHHMMSS>.bak and create a new one."
  1436.                ask q_backup_and_purge_old_database_directory "Would you like to backup your existing database directory and continue installing Puppet Enterprise?" yN
  1437.                if [ "y" != "${q_backup_and_purge_old_database_directory?}" ]; then
  1438.                    quit 1
  1439.                fi
  1440.            else
  1441.                q_backup_and_purge_old_database_directory='n'
  1442.            fi
  1443.  
  1444.            q_database_root_user="pe-postgres"
  1445.            : ${q_database_host:="${PLATFORM_HOSTNAME?}"}
  1446.             q_database_port='5432'
  1447.             # Verify that port 5432 is available for the pe-postgresql server
  1448.             if ( ! is_save_answers ) && ( ! is_upgrade ) && tcp_port_in_use "127.0.0.1" ${q_database_port} ; then
  1449.                 display_newline
  1450.                 display_failure "Port ${q_database_port} appears to be in use. This port is required for the Puppet Enterprise Postgresql Server. Please either move the services for this port to another or install on a system with this port available."
  1451.             fi
  1452.  
  1453.             q_database_root_password="${q_database_root_password:-"$(gen_password)"}"
  1454.  
  1455.             # We're doing setup, so set db variable defaults
  1456.             set_database_defaults
  1457.           elif [ y = "${q_puppetdb_install?}" -o y = "${q_puppet_enterpriseconsole_install?}" ] && ! is_upgrade; then
  1458.             # On split PuppetDB/Console installs, default to PuppetDB location
  1459.             # as the likely location of postgres. It's either that or they're
  1460.             # using their own. On combined or PuppetDB-only installs, we have
  1461.             # nothing to reasonably default to.
  1462.             if [ y = "${q_puppet_enterpriseconsole_install?}" -a ! y = "${q_puppetdb_install?}" ]; then
  1463.                 ask q_database_host "What is the hostname of the PostgreSQL server?" String "${q_puppetdb_hostname?}"
  1464.             else
  1465.                 ask q_database_host "What is the hostname of the PostgreSQL server?" String
  1466.             fi
  1467.             ask q_database_port "What is the port of the PostgreSQL server?" Port "5432"
  1468.             if [ y = "${q_puppet_enterpriseconsole_install?}" -a ! y = "${q_database_install?}" ]; then
  1469.                 ask q_pe_database "Was the PostgreSQL server installed and configured by Puppet Enterprise?" yN
  1470.             fi
  1471.             if [ y = "${q_puppetdb_install?}" ]; then
  1472.                 ask q_puppetdb_database_name "What is the name of the PuppetDB database?" String pe-puppetdb
  1473.                 ask q_puppetdb_database_user "What is the name of the PuppetDB database user?" String pe-puppetdb
  1474.                 ask q_puppetdb_database_password "What is the password for ${q_puppetdb_database_user?} (the database user)?" Password4
  1475.             fi
  1476.         fi
  1477.  
  1478.         if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1479.             if ! is_upgrade; then
  1480.                 # We already know the port to use in an upgrade, so we don't want to find a new one or ask.
  1481.                 if ! is_save_answers; then
  1482.                     default_console_port=$(find_unused_tcp_port "127.0.0.1" "${CONSOLE_PORT_OPTIONS}")
  1483.                     if [ -z "${default_console_port}" ] ; then
  1484.                         ask q_puppet_enterpriseconsole_httpd_port "None of the default ports (${CONSOLE_PORT_OPTIONS}) are open for use by the PE console. What is a port for use by the PE console?" Port
  1485.                     else
  1486.                         q_puppet_enterpriseconsole_httpd_port="${q_puppet_enterpriseconsole_httpd_port:-"${default_console_port}"}"
  1487.                    fi
  1488.                else
  1489.                    ask q_puppet_enterpriseconsole_httpd_port "What is a port for use by the PE console?" Port "443"
  1490.                fi
  1491.            fi
  1492.  
  1493.            if [ y = "${q_puppetmaster_install}" ]; then
  1494.                :                ${q_puppet_enterpriseconsole_master_hostname:="${q_puppetmaster_certname?}"}
  1495.             fi
  1496.  
  1497.             set_t_path_to_psql
  1498.  
  1499.             if ! is_upgrade && [ ! y = "${q_database_install?}" ]; then
  1500.                 ask q_puppet_enterpriseconsole_database_name "What is the name of the console database?" String console
  1501.                 ask q_puppet_enterpriseconsole_database_user "What is the name of the console database user?" String console
  1502.                 ask q_puppet_enterpriseconsole_database_password "What is the password for ${q_puppet_enterpriseconsole_database_user?} (the database user)?" Password4
  1503.  
  1504.             fi
  1505.  
  1506.             if is_upgrade && [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  1507.                 display_newline
  1508.                 echo '!!! WARNING: Existing Puppet Enterprise Console users will not be migrated. Please set a new password for your superuser.' | display_wrapped_text 0
  1509.                 display_newline
  1510.                 display_newline
  1511.             fi
  1512.  
  1513.             if ! is_upgrade || [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  1514.                 ask q_puppet_enterpriseconsole_auth_password "Password for Puppet Enterprise Console superuser 'admin' (minimum 8 characters)?" Password8
  1515.  
  1516.                 if [ ! y = "${q_database_install?}" ]; then
  1517.                     ask q_rbac_database_name "What is the name of the RBAC database?" String pe-rbac
  1518.                     ask q_rbac_database_user "What is the name of the RBAC database user?" String pe-rbac
  1519.                     ask q_rbac_database_password "What is the password for ${q_rbac_database_user?} (the database user)?" Password4
  1520.                     ask q_activity_database_name "What is the name of the Activity database?" String pe-activity
  1521.                     ask q_activity_database_user "What is the name of the Activity database user?" String pe-activity
  1522.                     ask q_activity_database_password "What is the password for ${q_activity_database_user?} (the database user)?" Password4
  1523.                     ask q_classifier_database_name "What is the name of the Classifier database?" String pe-classifier
  1524.                     ask q_classifier_database_user "What is the name of the Classifier database user?" String pe-classifier
  1525.                     ask q_classifier_database_password "What is the password for ${q_classifier_database_user?} (the database user)?" Password4
  1526.                 fi
  1527.             fi
  1528.  
  1529.             if ! is_upgrade && [ ! y = "${q_puppetdb_install?}" ]; then
  1530.                 display_newline
  1531.                 echo "In order to properly classify ${q_puppetdb_hostname?} as a PuppetDB server and provide continued management, you must provide the PuppetDB database information." | display_wrapped_text
  1532.                 display_newline
  1533.                 ask q_puppetdb_database_name "What is the name of the PuppetDB database?" String pe-puppetdb
  1534.                 ask q_puppetdb_database_user "What is the name of the PuppetDB database user?" String pe-puppetdb
  1535.                 ask q_puppetdb_database_password "What is the password for ${q_puppetdb_database_user?} (the database user)?" Password4
  1536.             fi
  1537.  
  1538.             # If it's a remote postgres and we're not just saving answers, we
  1539.             # need to validate that we can connect, and that the
  1540.             # databases/users exist. If it's our postgres, we're already going
  1541.             # to be ensuring those things, so no need to validate.
  1542.             if [ n = "${q_database_install?}" ] && ! is_save_answers; then
  1543.                 if [ -n "${t_path_to_psql}" ]; then
  1544.                     verify_db
  1545.                     need_to_verify_db=n
  1546.                 else
  1547.                     need_to_verify_db=y
  1548.                 fi
  1549.             fi
  1550.         fi
  1551.     else
  1552.         display_newline
  1553.         if [ "${PLATFORM_NAME}" = "aix" ] ; then
  1554.             PLATFORM_DISPLAY_NAME=AIX
  1555.         else
  1556.             PLATFORM_DISPLAY_NAME=${PLATFORM_NAME}
  1557.         fi
  1558.         echo "${PLATFORM_DISPLAY_NAME?} ${PLATFORM_RELEASE?} only supports agent installation."
  1559.         q_puppetmaster_install='n'
  1560.         q_puppet_enterpriseconsole_install='n'
  1561.         q_puppetca_install='n'
  1562.         q_puppetagent_install='y'
  1563.         q_puppet_cloud_install='n'
  1564.         q_puppetdb_install='n'
  1565.         q_database_install='n'
  1566.         q_all_in_one_install='n'
  1567.  
  1568.         ask q_puppetagent_server "Puppet master hostname to connect to?" String puppet
  1569.         if ( ! is_save_answers ) && [ 'n' = "${q_skip_master_verification:-"n"}" ] ; then
  1570.             while ! tcp_port_in_use "${q_puppetagent_server}" 8140 ; do
  1571.                 query_about_master_connectivity
  1572.             done
  1573.         fi
  1574.         :       ${q_fail_on_unsuccessful_master_lookup:='y'}
  1575.         :       ${q_puppetca_hostname:=${q_puppetagent_server?}}
  1576.     fi
  1577.  
  1578.     if [ y = "${q_puppetagent_install?}" ]; then
  1579.         t_default_agent_certname="${PLATFORM_HOSTNAME?}"
  1580.         # If we're on a master, and the user isn't driving the installer from an answer file
  1581.         # set the certname to the master certname provided earlier
  1582.         if [ y = "${q_puppetmaster_install?}" ]; then
  1583.             # Update the default value to remove visually jarring difference in default/answer.
  1584.             t_default_agent_certname="${q_puppetmaster_certname}"
  1585.             if [ -z "${q_puppetagent_certname}" ]; then
  1586.                 q_puppetagent_certname="${q_puppetmaster_certname}"
  1587.             fi
  1588.             :            ${q_puppetagent_server:="${q_puppetmaster_certname?}"}
  1589.        else
  1590.            ask q_puppetagent_certname "Puppet agent needs a unique name (\"certname\") for its certificate; this can be an arbitrary string. Certname for this node?" StringForceLowerCase "${t_default_agent_certname}"
  1591.  
  1592.            if [ y = "${q_puppet_enterpriseconsole_install?}" -a n = "${q_puppetmaster_install?}" ]; then
  1593.                :                ${q_puppet_enterpriseconsole_master_hostname:="${q_puppetagent_server?}"}
  1594.             fi
  1595.         fi
  1596.         :                ${q_puppetmaster_enterpriseconsole_certname:="${q_puppetagent_certname?}"}
  1597.    fi
  1598.  
  1599.    if [ y = "${q_puppetdb_install?}" ]; then
  1600.        # We need to know this for classification, and to bind host and port
  1601.        :       ${q_puppetdb_hostname:="${q_puppetagent_certname?}"}
  1602.     fi
  1603.  
  1604.     if [ ! y = "${q_puppetmaster_install?}" ] && [ y = "${q_puppet_enterpriseconsole_install?}" -o y = "${q_puppetdb_install?}" ]; then
  1605.         # In case the user deleted their old answer file we do this on upgrades as well
  1606.         ask q_puppetmaster_certname "What is the certname of the puppet master?" StringForceLowerCase "${q_puppetagent_server?}"
  1607.     fi
  1608.  
  1609.     if [ 'xaix' = "x${PLATFORM_NAME}" -a -x /usr/sbin/updtvpkg ] ; then
  1610.         display_product 'updtvpkg' "Puppet Enterprise contains rpm packages that depend on native AIX libraries. In order to resolve these dependencies correctly, the 'updtvpkg' command is used to populate the rpm database with the native AIX libraries already present on the system."
  1611.         ask q_run_updtvpkg "Run 'updtvpkg' to populate the rpm database with available native libaries? (this may take some time)" Yn
  1612.     else
  1613.         q_run_updtvpkg=n
  1614.     fi
  1615.  
  1616.     #...[ Vendor packages ].................................................
  1617.  
  1618.     enqueue_vendor_packages
  1619.  
  1620.     # Determine which vendor packages are missing
  1621.     t_main_missing_vendor_packages="$(missing_queued_packages)"
  1622.  
  1623.     # Continue interview
  1624.     if [ ! -z "${ANSWER_FILE_TO_SAVE?}" ]; then
  1625.       # When saving answers, always prompt user to install vendor packages
  1626.       display_product 'Vendor Packages' "Puppet Enterprise may require additional packages from your operating system vendor. You will need to either install these yourself, or allow them to be automatically installed from your operating system's package repositories."
  1627.       if [ ! -z "${t_main_missing_vendor_packages?}" ]; then
  1628.         if [ -d `platform_package_dir` ]; then
  1629.           display_missing_vendor_packages "${t_main_missing_vendor_packages?}"
  1630.         fi
  1631.       fi
  1632.       ask q_vendor_packages_install 'Allow automatic installation of these packages?' Yn
  1633.     elif [ ! -z "${t_main_missing_vendor_packages?}" ]; then
  1634.       # Check for RHEL4 here and bail if we're missing vendor packages.
  1635.       # RHEL4 doesn't have yum, so installing vendor packages is an exercise left to the user
  1636.       if [ "${VENDOR_PACKAGE_OFFLINE?}" = "true" ]; then
  1637.         display_product 'Vendor Packages' "The installer has detected that Puppet Enterprise requires additional packages from your operating system vendor's repositories, and cannot automatically install them. The installer will now exit so you can install them manually."
  1638.         display_missing_vendor_packages "${t_main_missing_vendor_packages?}"
  1639.         display_failure "You must manually install the above packages before installing Puppet Enterprise."
  1640.       else
  1641.         # When running, only prompt user to install vendor packages if needed
  1642.         display_product 'Vendor Packages' "The installer has detected that Puppet Enterprise requires additional packages from your operating system vendor's repositories, and can automatically install them. If you choose not to install these packages automatically, the installer will exit so you can install them manually."
  1643.         display_missing_vendor_packages "${t_main_missing_vendor_packages?}"
  1644.         ask q_vendor_packages_install 'Install these packages automatically?' Yn
  1645.         if [ ! y = "${q_vendor_packages_install?}" ]; then
  1646.           display_failure "You must manually install the above packages before installing Puppet Enterprise."
  1647.         fi
  1648.       fi
  1649.     else
  1650.       # Set default value
  1651.       q_vendor_packages_install="${q_vendor_packages_install:-"n"}"
  1652.     fi
  1653.  
  1654.     #...[ Check for existing configuration ]...............................
  1655.  
  1656.     if is_pe_service_install && ! is_upgrade && [ "y" != "${q_skip_backup}" ]; then
  1657.         if ( ! is_save_answers ) && [ -x /etc/puppetlabs ] ; then
  1658.             display_newline
  1659.             display " === Existing Puppet Enterprise configuration detected === "
  1660.             display_newline
  1661.  
  1662.             display_comment "It looks like Puppet Enterprise had been installed on this machine and it was uninstalled without the purge option (-p). The existing configuration cannot be reused by this installer. You can either quit this installation or the installer can move your existing configuration to /etc/puppetlabs.<yyyymmddHHMMSS>.bak and create a new one."
  1663.             ask q_backup_and_purge_old_configuration "Would you like to backup your existing configuration and continue installing Puppet Enterprise?" yN
  1664.             if [ "y" != "${q_backup_and_purge_old_configuration?}" ]; then
  1665.                 quit 1
  1666.             fi
  1667.         else
  1668.             q_backup_and_purge_old_configuration='n'
  1669.         fi
  1670.     fi
  1671.  
  1672.     #...[ Check directory environment migration ]..............................
  1673.  
  1674.     if is_upgrade; then
  1675.         if ! run "/opt/puppet/bin/rake -s -f '${INSTALLER_DIR}/environments.rake' environments:check 2>/dev/null"; then
  1676.             display_newline
  1677.             display_comment "It looks like Puppet Enterprise has discovered issues with your current configuration and will be unable to migrate to directory environments if these issues are not fixed first. Please make the appropriate changes to puppet.conf or contact Puppet Labs support. Puppet Enterprise components and configuration files have not been changed."
  1678.             ask q_environment_check_failed "Are you sure you want to continue?" yN
  1679.             if [ "y" != "${q_environment_check_failed?}" ]; then
  1680.                 quit 1
  1681.             fi
  1682.         fi
  1683.     fi
  1684.  
  1685.     #---[ Quit early ]------------------------------------------------------
  1686.  
  1687.     if ! is_pe_service_install && [ ! y = "${q_puppetagent_install?}" -a ! y = "${q_puppet_cloud_install?}" ]; then
  1688.         display_newline
  1689.         display_major_separator
  1690.         display_newline
  1691.         display_failure "Nothing selected for installation"
  1692.     fi
  1693.  
  1694.     #---[ Confirm ]---------------------------------------------------------
  1695.  
  1696.     display_step 'CONFIRM PLAN'
  1697.  
  1698.     render_plan
  1699.  
  1700.     #---[ Set OFFER_ROLL_BACK flag ]----------------------------------------------
  1701.     # Up until this point, we have made no changes to a system, so a failure
  1702.     # prior to this point would not require any sort of roll-back to restore
  1703.     # a system to a pristine state. After this point, we may have modified a
  1704.     # a system, if only to save an answers file, so we can offer to roll
  1705.     # back using the uninstaller
  1706.     OFFER_ROLL_BACK='y'
  1707.  
  1708.     if is_upgrade; then
  1709.         if is_pe_service_install; then
  1710.             display "It is strongly recommended that you take a snapshot of this system before performing the upgrade."
  1711.             display_newline
  1712.         fi
  1713.  
  1714.         ask q_install 'Perform upgrade?' Yn
  1715.     else
  1716.         ask q_install 'Perform installation?' Yn
  1717.     fi
  1718.  
  1719.     if [ y = "${q_database_install}" ]; then
  1720.         #---[ Sanitize q_database_host for ssl ]-----------------------------
  1721.         if [ "${q_database_host}" == 'localhost' ]; then
  1722.             q_database_host=$q_puppetagent_certname
  1723.         fi
  1724.     fi
  1725.  
  1726.     if [ ! y = "${q_install?}" ]; then
  1727.         display_newline
  1728.         display_major_separator
  1729.         display_newline
  1730.         display "!! Installation cancelled"
  1731.         display_newline
  1732.         display_major_separator
  1733.         do_save_answers
  1734.         quit 1
  1735.     else
  1736.         if ! is_upgrade; then
  1737.           if [ "y" = "${q_backup_and_purge_old_configuration:-'n'}" ]; then
  1738.             run "mv /etc/puppetlabs /etc/puppetlabs.$(date '+%Y%m%d%H%M%S').bak"
  1739.             run "./puppet-enterprise-uninstaller -py"
  1740.           fi
  1741.  
  1742.           if [ "y" = "${q_backup_and_purge_old_database_directory:-'n'}" ]; then
  1743.             run "mv /opt/puppet/var/lib/pgsql /opt/puppet/var/lib/pgsql.$(date '+%Y%m%d%H%M%S').bak"
  1744.           fi
  1745.         fi
  1746.  
  1747.         do_save_answers
  1748.         if [ y = "${q_database_install}" ]; then
  1749.             save_database_info_etc
  1750.         fi
  1751.     fi
  1752.  
  1753.     #---[ Ignore q_upgrade_installation=y, #16091 ]------------------------
  1754.     ignore_duplicate 'upgrade'
  1755.  
  1756.     #---[ Export answers for use with erb ]---------------------------------
  1757.  
  1758.     for t_env_variable in `set | ${PLATFORM_EGREP?} '^q_' | sed -n 's/^\(q_[^=][^=]*\).*$/\1/p'`; do export ${t_env_variable}; done
  1759.     # Export a non-q variable
  1760.     export PLATFORM_HOSTNAME
  1761.  
  1762.     # PLATFORM_HOSTNAME_SHORT is used by databases.erb
  1763.     export PLATFORM_HOSTNAME_SHORT
  1764.  
  1765.     # This is needed for puppet.conf
  1766.     export PLATFORM_NAME
  1767.     export PLATFORM_PUPPET_GROUP
  1768.     export PLATFORM_PUPPET_USER
  1769.  
  1770.     # These are used to make package repos
  1771.     export PE_VERSION
  1772.     export PLATFORM_TAG
  1773.  
  1774.     #---[ Stop services for upgrade ]---------------------------------------
  1775.  
  1776.     if is_upgrade ; then
  1777.         display_comment "Stopping Puppet Enterprise services for upgrade"
  1778.  
  1779.         if is_puppetmaster; then
  1780.             if [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ]; then
  1781.                 puppet_resource "service pe-httpd ensure=stopped"
  1782.             else
  1783.                 puppet_resource "service pe-puppetserver ensure=stopped"
  1784.             fi
  1785.         fi
  1786.         if is_console; then
  1787.             puppet_resource "service pe-httpd ensure=stopped"
  1788.             puppet_resource "service pe-puppet-dashboard-workers ensure=stopped"
  1789.         fi
  1790.         if is_puppetdb; then
  1791.             puppet_resource "service pe-puppetdb ensure=stopped"
  1792.         fi
  1793.         if is_postgres; then
  1794.             puppet_resource "service pe-postgresql ensure=stopped"
  1795.         fi
  1796.         for agent in pe-puppet pe-puppet-agent puppetagent; do
  1797.             puppet_resource "service $agent ensure=stopped" ||:
  1798.         done
  1799.     fi
  1800.     #---[ Enqueue our packages ]--------------------------------------------
  1801.  
  1802.     # NONPORTABLE
  1803.     # Install cloud gems
  1804.     if [ y = ${q_puppet_cloud_install?} ]; then
  1805.         handle_cloud
  1806.     fi
  1807.  
  1808.     if [ "${VENDOR_PACKAGE_OFFLINE?}" = "true" ]; then
  1809.         # If we've gotten this far, all of the vendor packages are installed,
  1810.         # so we need to unset the variable to allow the installation of all
  1811.         # rpms regardless of presence.
  1812.         unset PACKAGES_REQUIRED
  1813.     fi
  1814.  
  1815.     enqueue_agent_packages
  1816.  
  1817.     if [ y = "${q_puppetmaster_install?}" ]; then
  1818.         if is_upgrade && [ 'y' != "${q_all_in_one_install?}" -a "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  1819.             # Upgrade these packages so we don't have to worry about
  1820.             # metapackages from earlier releases like 3.0.1
  1821.             # Also upgrade these before the master manifest is applied so
  1822.             # the version-check in the puppetserver package doesn't conflict
  1823.             enqueue_package 'pe-httpd'
  1824.             enqueue_package 'pe-passenger'
  1825.             enqueue_package 'pe-rubygem-rack'
  1826.         fi
  1827.         enqueue_package 'pe-java'
  1828.         enqueue_package 'pe-puppetserver'
  1829.         enqueue_package 'pe-puppetserver-common'
  1830.         enqueue_package 'pe-license'
  1831.         enqueue_package 'pe-puppet-license-cli'
  1832.         enqueue_package 'pe-puppetdb-terminus'
  1833.         enqueue_package 'pe-console-services-termini'
  1834.     fi
  1835.  
  1836.     if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  1837.         case "${PLATFORM_NAME?}" in
  1838.             amazon | centos | rhel | sles)
  1839.                 ;;
  1840.             ubuntu | debian)
  1841.                 enqueue_package 'pe-httpd-mpm-worker'
  1842.                 ;;
  1843.             *)
  1844.                 display_failure "Do not know how to install HTTPD on this platform"
  1845.                 ;;
  1846.         esac
  1847.         enqueue_package 'pe-httpd'
  1848.         enqueue_package 'pe-passenger'
  1849.         enqueue_package 'pe-rubygem-rack'
  1850.         enqueue_package 'pe-mcollective-client'
  1851.  
  1852.         # PostgreSQL Packages for PE Console
  1853.         enqueue_package 'pe-postgresql'
  1854.         # Dashboard Packages
  1855.         enqueue_package 'pe-puppet-dashboard'
  1856.         enqueue_package 'pe-bundler'
  1857.  
  1858.         # Live Management Packages
  1859.         enqueue_package 'pe-libevent'
  1860.         enqueue_package 'pe-memcached'
  1861.         enqueue_package 'pe-live-management'
  1862.         # Console packages
  1863.         enqueue_package 'pe-console-auth'
  1864.         enqueue_package 'pe-console'
  1865.         enqueue_package 'pe-certificate-manager'
  1866.         enqueue_package 'pe-license'
  1867.         enqueue_package 'pe-license-status'
  1868.         enqueue_package 'pe-event-inspector'
  1869.         enqueue_package 'pe-console-services'
  1870.  
  1871.         #FIXME Replace this with with explicit use of pe-psql
  1872.         t_path_to_psql='/opt/puppet/bin/psql'
  1873.     fi
  1874.  
  1875.  
  1876.     # This entire if block can be removed once we are managing postgresql with
  1877.     # the new puppet_enterprise module
  1878.     if [ y = "${q_puppetdb_install?}" ]; then
  1879.       # we are installing /opt/puppet/bin/psql at this point
  1880.       # override any previously found version
  1881.       t_path_to_psql='/opt/puppet/bin/psql'
  1882.       if [ y = "${q_database_install?}" ]; then
  1883.         enqueue_package 'pe-postgresql-server'
  1884.         enqueue_package 'pe-postgresql-contrib'
  1885.       fi
  1886.  
  1887.       enqueue_package 'pe-postgresql'
  1888.       enqueue_package 'pe-java'
  1889.       enqueue_package 'pe-puppetdb'
  1890.     fi
  1891.  
  1892.     #---[ Write out PE version ]-------------------------------------------
  1893.  
  1894.     # We need to do this before the puppet agent gets started for the first time
  1895.     # to ensure the version gets picked up correctly, so we pick the last time
  1896.     # before the packages are installed.
  1897.  
  1898.     if ! is_noop; then
  1899.         run_suppress_stdout "mkdir -p /opt/puppet && chown ${PLATFORM_ROOT_USER}:${PLATFORM_ROOT_GROUP} /opt/puppet && chmod 755 /opt/puppet"
  1900.         run_suppress_stdout "cp ${INSTALLER_DIR}/VERSION /opt/puppet/pe_build && chown ${PLATFORM_ROOT_USER}:${PLATFORM_ROOT_GROUP} /opt/puppet/pe_build && chmod 644 /opt/puppet/pe_build"
  1901.     fi
  1902.  
  1903.     #---[ Install support/uninstaller scripts ]------------------------------------------------
  1904.  
  1905.     if is_pe_service_install; then
  1906.         run_suppress_stdout "mkdir -p /opt/puppet/bin && chown ${PLATFORM_ROOT_USER}:${PLATFORM_ROOT_GROUP} /opt/puppet/bin && chmod 755 /opt/puppet/bin"
  1907.         run_suppress_stdout "mkdir -p /opt/puppet/share/installer && chown ${PLATFORM_ROOT_USER}:${PLATFORM_ROOT_GROUP} /opt/puppet/share /opt/puppet/share/installer && chmod 755 /opt/puppet/share /opt/puppet/share/installer"
  1908.         run_suppress_stdout "cp ${INSTALLER_DIR}/puppet-enterprise-support ${INSTALLER_DIR}/puppet-enterprise-uninstaller /opt/puppet/bin"
  1909.         run_suppress_stdout "cp ${INSTALLER_DIR}/utilities /opt/puppet/share/installer/utilities"
  1910.         run_suppress_stdout "chown ${PLATFORM_ROOT_USER}:${PLATFORM_ROOT_GROUP} /opt/puppet/bin/puppet-enterprise-support /opt/puppet/bin/puppet-enterprise-uninstaller /opt/puppet/share/installer/utilities"
  1911.         run_suppress_stdout "chmod 755 /opt/puppet/bin/puppet-enterprise-support /opt/puppet/bin/puppet-enterprise-uninstaller /opt/puppet/share/installer/utilities"
  1912.     fi
  1913.  
  1914.     #---[ Install packages ]------------------------------------------------
  1915.  
  1916.     display_step 'INSTALL PACKAGES'
  1917.  
  1918.     if [ 'y' = "${q_run_updtvpkg}" ] ; then
  1919.         display_comment 'Running /usr/sbin/updtvpkg to update rpm database...'
  1920.         run_suppress_output '/usr/sbin/updtvpkg'
  1921.     fi
  1922.  
  1923.     if is_upgrade && is_console && [ y = "${q_database_transfer?}" ]; then
  1924.         display_comment "Analyzing current database settings..."
  1925.  
  1926.         t_transfer_console_tmp_dir=$(run "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:tmpdir RAILS_ENV=production" | tail -n 1)
  1927.  
  1928.         #we need to know the original database names, user names, hosts and ports, and we need to store passwords to the source databases in a secure way
  1929.         t_source_console_db_name=$(run "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:console:current_database RAILS_ENV=production" | tail -n 1)
  1930.  
  1931.         display_comment "Current console database name is ${t_source_console_db_name?}"
  1932.  
  1933.         t_source_console_user_name=$(run "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:console:current_user RAILS_ENV=production" | tail -n 1)
  1934.  
  1935.         display_comment "Current console database user is ${t_source_console_user_name?}"
  1936.  
  1937.         t_source_console_host=$(run "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:console:current_host RAILS_ENV=production" | tail -n 1)
  1938.  
  1939.         display_comment "Current console database host is ${t_source_console_host?}"
  1940.  
  1941.         t_source_console_port=$(run "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:console:current_port RAILS_ENV=production" | tail -n 1)
  1942.  
  1943.         display_comment "Current console database port is ${t_source_console_port?}"
  1944.  
  1945.         # let's store the passwords now
  1946.         run "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:console:store_source_password RAILS_ENV=production TMPDIR=${t_transfer_console_tmp_dir?}"
  1947.  
  1948.         # we need the target databases to be migrated down to the same version as the source databases
  1949.         # therefore we need to figure out what the versions of current databases are
  1950.         t_source_console_db_version=$(run "/opt/puppet/bin/rake -s -R '${INSTALLER_DIR}' -f /opt/puppet/share/puppet-dashboard/Rakefile db:version RAILS_ENV=production" | ${PLATFORM_EGREP?} '^Current version:' | sed 's/^Current version: //g')
  1951.  
  1952.         display_comment "Current console database migration version is ${t_source_console_db_version?}"
  1953.  
  1954.     fi
  1955.  
  1956.     if is_upgrade; then
  1957.         display_comment 'Upgrading packages'
  1958.     fi
  1959.     install_queued_packages
  1960.    
  1961.     # On early versions of 3.7 for SLES 10 we installed pe-agent and rubygem-net-ssh, but they are no longer
  1962.     # needed, so we remove them here, if installed, to clean up.
  1963.     if [[ $PLATFORM_TAG =~ ${SLES_10_REGEX?} ]]; then
  1964.         if is_upgrade; then
  1965.             if is_package_installed 'pe-agent'; then
  1966.                 run_suppress_output "rpm -e --allmatches pe-agent"
  1967.             fi
  1968.             if is_package_installed 'pe-rubygem-net-ssh'; then
  1969.                 run_suppress_output "rpm -e --allmatches pe-rubygem-net-ssh"
  1970.             fi
  1971.         fi
  1972.     fi
  1973.  
  1974.     # If we couldn't verify postgres earlier (because it wasn't installed),
  1975.     # verify it now.
  1976.     if [ y = "${need_to_verify_db:-'n'}" ]; then
  1977.         verify_db
  1978.     fi
  1979.  
  1980.     #---[ Generate "puppet.conf" ]------------------------------------------
  1981.  
  1982.     if is_upgrade; then
  1983.         if [ y = "${q_puppetmaster_install?}" ] && [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ]; then
  1984.             run "/opt/puppet/bin/rake -s -f '${INSTALLER_DIR}/environments.rake' environments:upgrade"
  1985.         fi
  1986.     else
  1987.         run "/opt/puppet/bin/erb -T - '${INSTALLER_DIR}/erb/puppet.conf.erb' > '/etc/puppetlabs/puppet/puppet.conf'"
  1988.         # Create the production environment.
  1989.         run "mkdir -p /etc/puppetlabs/puppet/environments/production/manifests /etc/puppetlabs/puppet/environments/production/modules"
  1990.     fi
  1991.  
  1992.  
  1993.     #---[ Setup packages ]--------------------------------------------------
  1994.  
  1995.     # All of these roles need local copies of the modules
  1996.     if is_pe_service_install; then
  1997.         install_puppet_modules
  1998.         # We just installed a bunch of modules, or upgraded them, which means
  1999.         # we may have swapped out a bunch of parser functions that had
  2000.         # already be loaded by pe-puppet (I'm looking at you, pe_accounts and
  2001.         # create_resource). Removing the contents of the libdir will get rid
  2002.         # of all the crufty functions, and pluginsync will later repopulate it
  2003.         # with new versions of the modules.
  2004.         if is_upgrade; then
  2005.           run_suppress_stdout "rm -rf `/opt/puppet/bin/puppet agent --configprint libdir`"
  2006.         fi
  2007.     fi
  2008.  
  2009.     if [ y = "${q_puppetmaster_install?}" ]; then
  2010.  
  2011.         if [ n = "${q_all_in_one_install}" ]; then
  2012.             # Uses
  2013.             #  q_puppetmaster_enterpriseconsole_hostname
  2014.             #  q_puppetdb_hostname
  2015.             run "/opt/puppet/bin/erb -T - '${INSTALLER_DIR?}/erb/autosign.conf.erb' >> '/etc/puppetlabs/puppet/autosign.conf'"
  2016.         fi
  2017.  
  2018.         # Generate the master's SSL server certificate
  2019.         if ! is_noop && [ ! -e "$(/opt/puppet/bin/puppet master --configprint hostcert)" ]; then
  2020.             run_suppress_stdout "/opt/puppet/bin/puppet cert --generate ${q_puppetmaster_certname?} --ca_name 'Puppet CA generated on ${q_puppetca_hostname?} at $(date '+%Y-%m-%d %H:%M:%S %z')' --dns_alt_names '${q_puppetmaster_dnsaltnames?}' --verbose --color=false || true"
  2021.         fi
  2022.  
  2023.         # Mcollective utilizes a shared public/private key between all users
  2024.         # as well as a private/public key pair for each mco client.
  2025.         # Every MCO server than needs a copy of that MCO clients public key.
  2026.         # There currently exists no ideal solution to this problem short of writing a new
  2027.         # mco security provider. For now we are forced to generate the public/private keypairs on
  2028.         # the master during initial install, and then send them as files in the catalog to whichever nodes get
  2029.         # classified with the correct mcollective classes.
  2030.         t_mco_shared_keypair_name="pe-internal-mcollective-servers"
  2031.         t_mco_peadmin_key_name="pe-internal-peadmin-mcollective-client"
  2032.         t_mco_console_key_name="pe-internal-puppet-console-mcollective-client"
  2033.  
  2034.         for certname in ${t_mco_shared_keypair_name?} ${t_mco_peadmin_key_name?} ${t_mco_console_key_name?}; do
  2035.           generate_certs $certname
  2036.         done
  2037.  
  2038.         display "Generating mcollective password..."
  2039.         gen_password "/etc/puppetlabs/mcollective/credentials"
  2040.         run_suppress_stdout "chown ${PLATFORM_PUPPET_USER}:${PLATFORM_PUPPET_GROUP} /etc/puppetlabs/mcollective/credentials"
  2041.         run_suppress_stdout "chmod 600 /etc/puppetlabs/mcollective/credentials"
  2042.     fi
  2043.  
  2044.     if [ ! -s "/etc/puppetlabs/puppet/ssl/private_keys/${q_puppetagent_certname?}.pem" ]; then
  2045.         if [ "${q_puppetmaster_install?}" = y ]; then
  2046.             run_suppress_stdout "/opt/puppet/bin/puppet cert generate ${q_puppetagent_certname?} --color=false" || :
  2047.         else
  2048.             # Generate the agent credentials by attempting to contact the master
  2049.             run_suppress_stdout "/opt/puppet/bin/puppet certificate find ${q_puppetagent_certname?} --ca-location remote --ca_server ${q_puppetca_hostname?}" || :
  2050.         fi
  2051.     fi
  2052.     # Generate the certs for the console
  2053.     if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  2054.         # On upgrades pe-internal-dashboard certs may
  2055.         # have been moved from puppet's ssl dir, so here we copy them back to
  2056.         # have a consistent way to check if they need to be generated
  2057.         t_dashboard_cert_dir="/opt/puppet/share/puppet-dashboard/certs/"
  2058.         t_dashboard_client_private_key="${t_dashboard_cert_dir?}/pe-internal-dashboard.private_key.pem"
  2059.         t_dashboard_client_public_key="${t_dashboard_cert_dir?}/pe-internal-dashboard.public_key.pem"
  2060.         t_dashboard_client_cert="${t_dashboard_cert_dir?}/pe-internal-dashboard.cert.pem"
  2061.         t_puppet_ssl_dir="/etc/puppetlabs/puppet/ssl"
  2062.         if [ -s "${t_dashboard_client_private_key?}" -a ! -s "${t_puppet_ssl_dir?}/private_keys/pe-internal-dashboard.pem" ]; then
  2063.             run_suppress_stdout "cp ${t_dashboard_client_private_key?} ${t_puppet_ssl_dir?}/private_keys/pe-internal-dashboard.pem"
  2064.             run_suppress_stdout "cp ${t_dashboard_client_public_key?} ${t_puppet_ssl_dir?}/public_keys/pe-internal-dashboard.pem"
  2065.             run_suppress_stdout "cp ${t_dashboard_client_cert?} ${t_puppet_ssl_dir?}/certs/pe-internal-dashboard.pem"
  2066.         fi
  2067.         for certname in "pe-internal-dashboard" "pe-internal-classifier"; do
  2068.             generate_certs $certname
  2069.         done
  2070.     fi
  2071.  
  2072.     if [ y = "${q_puppetmaster_install?}" ]; then
  2073.         display_comment 'Setting up puppet master...'
  2074.  
  2075.         if ! is_upgrade; then
  2076.             t_environmentpath=$(/opt/puppet/bin/puppet config print environmentpath)
  2077.             run "/opt/puppet/bin/erb -T - '${INSTALLER_DIR}/erb/site.pp.erb' > '${t_environmentpath}/production/manifests/site.pp'"
  2078.         fi
  2079.  
  2080.         create_package_repo
  2081.         #Setup a repo for the simplified agent and future masters / amq nodes to use
  2082.         setup_package_repo
  2083.  
  2084.         # Copy modules into place to be served via puppet's fileserver to
  2085.         # secondary masters
  2086.         create_module_mount
  2087.  
  2088.         if is_upgrade && [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  2089.  
  2090.             display_comment 'Updating puppet.conf SSL settings'
  2091.             puppet_resource "pe_ini_setting /etc/puppetlabs/puppet/puppet.conf path=/etc/puppetlabs/puppet/puppet.conf section=master setting=ssl_client_header ensure=absent"
  2092.             puppet_resource "pe_ini_setting /etc/puppetlabs/puppet/puppet.conf path=/etc/puppetlabs/puppet/puppet.conf section=master setting=ssl_client_verify_header ensure=absent"
  2093.  
  2094.             # TODO: These files should be backed up
  2095.             display_comment 'Cleaning up old httpd configuration'
  2096.             t_httpd_confdir="/etc/puppetlabs/httpd/conf.d"
  2097.             run_suppress_stdout "rm -f ${t_httpd_confdir}/puppetmaster.conf"
  2098.             run_suppress_stdout "rm -f ${t_httpd_confdir}/headers.conf"
  2099.             run_suppress_stdout "rm -rf /var/opt/lib/pe-puppetmaster"
  2100.  
  2101.             if [ 'y' != "${q_all_in_one_install?}" ] ; then
  2102.                 run_suppress_stdout "rm -f ${t_httpd_confdir}/passenger-extra.conf"
  2103.             else
  2104.                 bounce_service "pe-httpd"
  2105.             fi
  2106.         fi
  2107.         # Uses
  2108.         #  q_puppetmaster_certname
  2109.         #  q_puppetmaster_dnsaltnames
  2110.         #  q_puppetmaster_enterpriseconsole_hostname
  2111.         #  q_puppetmaster_enterpriseconsole_certname
  2112.         #  q_puppet_enterpriseconsole_install
  2113.         #  q_puppetdb_hostname
  2114.         #  t_puppetserver_java_args
  2115.         apply_template_manifest "master.pp.erb"
  2116.  
  2117.         remove_package_repo
  2118.  
  2119.         if is_upgrade; then
  2120.             # These files are not used by PE anymore, they can be safely removed
  2121.             for file in send_cert_request.rb receive_signed_cert.rb; do
  2122.                 if [ -f "/opt/puppet/bin/${file}" ]; then
  2123.                     run_suppress_stdout "rm -f /opt/puppet/bin/${file}"
  2124.                 fi
  2125.             done
  2126.  
  2127.             display_comment 'Updating puppet.conf report processors'
  2128.             puppet_resource "pe_ini_subsetting /etc/puppetlabs/puppet/puppet.conf path=/etc/puppetlabs/puppet/puppet.conf section=master setting=reports subsetting=https subsetting_separator=, ensure=absent"
  2129.             puppet_resource "pe_ini_subsetting /etc/puppetlabs/puppet/puppet.conf path=/etc/puppetlabs/puppet/puppet.conf section=master setting=reports subsetting=http subsetting_separator=, ensure=absent"
  2130.             puppet_resource "pe_ini_setting /etc/puppetlabs/puppet/puppet.conf path=/etc/puppetlabs/puppet/puppet.conf section=master setting=reporturl ensure=absent"
  2131.  
  2132.             # Remove the MRI master-specific packages if this is a master-only
  2133.             # install from PE < 3.7. We don't remove them on an all-in-one
  2134.             # because they're still used by the console.
  2135.             if [ 'y' != "${q_all_in_one_install?}" -a "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  2136.                 puppet_package "pe-httpd" "purged"
  2137.                 case "${PLATFORM_NAME?}" in
  2138.                     amazon | centos | rhel | sles)
  2139.                         puppet_package "pe-httpd-devel" "purged"
  2140.                         puppet_package "pe-mod_ssl" "purged"
  2141.                         puppet_package "pe-libapr" "purged"
  2142.                         puppet_package "pe-libaprutil" "purged"
  2143.                         puppet_package "pe-libldap" "purged"
  2144.                         ;;
  2145.                     ubuntu | debian)
  2146.                         puppet_package "pe-httpd-utils" "purged"
  2147.                         puppet_package "pe-httpd-common" "purged"
  2148.                         puppet_package "pe-httpd-bin" "purged"
  2149.                         ;;
  2150.                 esac
  2151.                 puppet_package "pe-passenger" "purged"
  2152.                 puppet_package "pe-rubygem-rack" "purged"
  2153.             fi
  2154.         fi
  2155.         t_wait_for_puppetmaster_url="https://${q_puppetmaster_certname?}:8140"
  2156.         if ! is_noop && ! wait_for_service $t_wait_for_puppetmaster_url 120 ; then
  2157.             display_failure "The puppet master service failed to start within 120 seconds; unable to proceed"
  2158.         fi
  2159.     fi
  2160.  
  2161.     display_comment 'Checking the agent certificate name detection...'
  2162.     if run_suppress_stdout "/opt/puppet/bin/puppet agent --configprint certname --color=false"; then
  2163.         if [ ! y = "${q_puppetmaster_install?}" ] && [ y = "${q_puppet_enterpriseconsole_install?}" -o y = "${q_puppetdb_install?}" -o y = "${q_puppet_agent_first_run:-"y"}" ] ; then
  2164.           display_comment 'Setting up puppet agent...'
  2165.           run_suppress_stdout "/opt/puppet/bin/puppet agent --test --color=false || true"
  2166.         fi
  2167.     else
  2168.         display_failure 'The agent certificate name was incorrect; please check that your system can correctly resolve its own FQDN in DNS.'
  2169.     fi
  2170.  
  2171.     if [ y = "${q_database_install?}" ]; then
  2172.         display_comment 'Setting up the database...'
  2173.  
  2174.         # Verify that we can set the password here.
  2175.         configure_postgresql_server
  2176.  
  2177.         # Now we've created databases and users, so if we roll back, we should run it with the -d flag
  2178.         ROLL_BACK_DBS='y'
  2179.     fi
  2180.  
  2181.     # If this is a fresh db install we should be setting the password to the desired password. If we are just setting the db up we
  2182.     # have already verified the credentials so we should be able to just set up the dbs.
  2183.     if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  2184.         display_comment 'Setting up the console...'
  2185.  
  2186.         # If q_public_hostname is set by the answer file, use that. Otherwise,
  2187.         # it defaults to the detected hostname, unless we're on EC2 in which
  2188.         # case we use the public-hostname from the EC2 data.
  2189.         if [ -z "${q_public_hostname}" ]; then
  2190.             q_public_hostname="${PLATFORM_HOSTNAME?}"
  2191.  
  2192.             export q_public_hostname
  2193.         fi
  2194.  
  2195.         if ! is_upgrade; then
  2196.             # Generate the session key for settings.yml
  2197.             t_session_key_dashboard=`dd if=/dev/urandom bs=4k count=512 2> /dev/null | sha512sum  | $PLATFORM_AWK '{print $1}'`
  2198.             export t_session_key_dashboard
  2199.         fi
  2200.  
  2201.         if is_upgrade; then
  2202.             #...[ settings.yml ]....................................................
  2203.             if [ -s '/etc/puppetlabs/puppet-dashboard/settings.yml' ]; then
  2204.                 backup_file '/etc/puppetlabs/puppet-dashboard/settings.yml'
  2205.                 # Add new settings if they don't exist
  2206.                 if [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  2207.                     add_key_and_value_to_yaml_file '/etc/puppetlabs/puppet-dashboard/settings.yml' 'dashboard_server' ${q_puppetagent_certname?}
  2208.                     add_key_and_value_to_yaml_file '/etc/puppetlabs/puppet-dashboard/settings.yml' 'dashboard_port' '4435'
  2209.                     add_key_and_value_to_yaml_file '/etc/puppetlabs/puppet-dashboard/settings.yml' 'nc_api_url' "'https://${q_puppetagent_certname?}:4433/classifier-api'"
  2210.                     add_key_and_value_to_yaml_file '/etc/puppetlabs/puppet-dashboard/settings.yml' 'certificate_whitelist' '/etc/puppetlabs/puppet-dashboard/dashboard-certificate-whitelist'
  2211.                 fi
  2212.  
  2213.                 # Live Management Toggle settings
  2214.                 # If the LM variable doesn't exist in settings.yml, add it
  2215.                 # Otherwise, if the user has specified a desired state, change it to that
  2216.                 if ! ${PLATFORM_EGREP?} -q 'disable_live_management:' '/etc/puppetlabs/puppet-dashboard/settings.yml'; then
  2217.                     run "sed -i -e '\$i\\\n# Set this to true to disable Live Management on this node\n# If this is changed, you must restart pe-httpd' '/etc/puppetlabs/puppet-dashboard/settings.yml'"
  2218.                     if [ y = "${q_disable_live_management}" ]; then
  2219.                         run "sed -i -e '\$i\\disable_live_management: true' '/etc/puppetlabs/puppet-dashboard/settings.yml'"
  2220.                     else
  2221.                         run "sed -i -e '\$i\\disable_live_management: false' '/etc/puppetlabs/puppet-dashboard/settings.yml'"
  2222.                     fi
  2223.                 else
  2224.                     if [ y = "${q_disable_live_management}" ]; then
  2225.                         run "sed -i -e 's/disable_live_management:.*/disable_live_management: true/' '/etc/puppetlabs/puppet-dashboard/settings.yml'"
  2226.                     elif [ n = "${q_disable_live_management}" ]; then
  2227.                         run "sed -i -e 's/disable_live_management:.*/disable_live_management: false/' '/etc/puppetlabs/puppet-dashboard/settings.yml'"
  2228.                     fi
  2229.                 fi
  2230.             fi
  2231.  
  2232.             if [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  2233.                 # Export old classification data to a file to be imported later. Only for PE < 3.7 upgrades
  2234.                 if ! verbose_bundle_exec "/opt/puppet/bin/rake -s -f /opt/puppet/share/puppet-dashboard/Rakefile configuration:export['/opt/puppet/share/installer/pe_classification_export.yml'] RAILS_ENV=production"; then
  2235.                     display_failure "Rake task could not export classification."
  2236.                 fi
  2237.             fi
  2238.  
  2239.         fi
  2240.  
  2241.         if is_upgrade; then
  2242.             export t_stomp_password=$(get_ini_field '/etc/puppetlabs/mcollective/server.cfg' 'plugin.activemq.pool.1.password')
  2243.         fi
  2244.  
  2245.         # Uses
  2246.         #   @certname         = ENV['q_puppetagent_certname']
  2247.         #   @database_host    = ENV['q_database_host']
  2248.         #   @database_port    = ENV['q_database_port']
  2249.         #   @database         = ENV['q_enterpriseconsole_database_name']
  2250.         #   @user             = ENV['q_enterpriseconsole_database_user']
  2251.         #   @password         = ENV['q_enterpriseconsole_database_password'].gsub("'","")
  2252.         #   @master           = ENV['q_puppetagent_server']
  2253.         #   @master_certname  = ENV['q_puppetmaster_certname']
  2254.         #   @ca               = ENV['q_puppetca_hostname']
  2255.         #   @puppetdb         = ENV['q_puppetdb_hostname']
  2256.         #   @puppetdb_port    = ENV['q_puppetdb_port']
  2257.         #   @classifier_database_name     = ENV['q_classifier_database_name']
  2258.         #   @classifier_database_user     = ENV['q_classifier_database_user']
  2259.         #   @classifier_database_password = ENV['q_classifier_database_password'].gsub("'","")
  2260.         #   @rbac_database_name     = ENV['q_rbac_database_name']
  2261.         #   @rbac_database_user     = ENV['q_rbac_database_user']
  2262.         #   @rbac_database_password = ENV['q_rbac_database_password'].gsub("'","")
  2263.         #   @activity_database_name     = ENV['q_activity_database_name']
  2264.         #   @activity_database_user     = ENV['q_activity_database_user']
  2265.         #   @activity_database_password = ENV['q_activity_database_password'].gsub("'","")
  2266.         #   @secret_token     = ENV['t_session_key_dashboard']
  2267.         #   @manage_config    = ENV['IS_UPGRADE'] != 'y'
  2268.         #   @migrate_db       = true
  2269.         #   @disable_live_management  = ENV['q_disable_live_management'] == 'y'
  2270.         #   @stomp_password = ENV['t_stomp_password']
  2271.         #   t_console_services_java_args
  2272.         apply_template_manifest "console.pp.erb"
  2273.     fi
  2274.  
  2275.     if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  2276.         display_comment "Starting http server for puppet console."
  2277.  
  2278.         # NONPORTABLE
  2279.         case "${PLATFORM_NAME?}" in
  2280.             ubuntu | debian)
  2281.                 # Ubuntu's "pe-httpd" can't cope with ".bak" files.
  2282.                 run_suppress_stdout "rm -rf /etc/puppetlabs/httpd/*/*.bak"
  2283.                 # Ubuntu's "pe-httpd" doesn't enable some important modules by default
  2284.                 run_suppress_stdout "/opt/puppet/sbin/a2enmod ssl headers authnz_ldap ldap"
  2285.                 # Need to munge the /etc/default/pe-puppet-dashboard-workers init file for sanity
  2286.                 [ -f '/etc/default/pe-puppet-dashboard-workers' ] && run_suppress_stdout "sed -i 's/### START=no/START=yes/g' /etc/default/pe-puppet-dashboard-workers"
  2287.                 ;;
  2288.         esac
  2289.  
  2290.         bounce_service 'pe-memcached'
  2291.         enable_service 'pe-memcached'
  2292.  
  2293.         # Start the http service if we're an enterprise console with our certs automatically signed.
  2294.         bounce_service 'pe-httpd'
  2295.         enable_service 'pe-httpd'
  2296.  
  2297.         run_suppress_stdout 'touch /var/log/pe-puppet-dashboard/certificate_manager.log'
  2298.         run_suppress_stdout 'chown -Rvf puppet-dashboard:puppet-dashboard /var/log/pe-puppet-dashboard/*'
  2299.         bounce_service 'pe-puppet-dashboard-workers'
  2300.         enable_service 'pe-puppet-dashboard-workers'
  2301.     fi
  2302.  
  2303.     # On the PuppetDB node, this will configure PuppetDB itself.
  2304.     if [ y = "${q_puppetdb_install?}" ]; then
  2305.         configure_puppetdb
  2306.     fi
  2307.  
  2308.     if [ y = "${q_puppet_enterpriseconsole_install?}" ]; then
  2309.         # Postgres could be restarted again after configuring PuppetDB, so we
  2310.         # wait for it to come back up before proceeding to run rake tasks which
  2311.         # modify the DB. If we're not noop.
  2312.         if ! is_noop && [ y = "${q_database_install?}" ] && ! wait_for_db 20; then
  2313.             display_failure "The PostgreSQL server failed to start; unable to proceed"
  2314.         fi
  2315.  
  2316.         if ! is_noop; then
  2317.             # We are assuming that the node classifier will be on the same node as
  2318.             # the console for 3.7
  2319.             t_wait_for_nc_url="https://${q_puppetagent_certname}:4433/classifier-api"
  2320.             display 'Waiting for Node Classifier to start...'
  2321.             if wait_for_nc $t_wait_for_nc_url 120; then
  2322.                 display 'Applying configurations...'
  2323.  
  2324.                 if is_upgrade && [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  2325.                     # Import old classification data from a file to new classifier. Only for PE < 3.7 upgrades
  2326.                     if ! verbose_bundle_exec "/opt/puppet/bin/rake -s -f /opt/puppet/share/puppet-dashboard/Rakefile configuration:import['/opt/puppet/share/installer/pe_classification_export.yml'] RAILS_ENV=production"; then
  2327.                         display "!!! WARNING: Could not import classification; please check the logs in '/var/log/pe-console-services/' for more information."
  2328.                         t_import_classification_failure='y'
  2329.                     fi
  2330.                 fi
  2331.  
  2332.                 if ! is_upgrade || [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  2333.                     # Make update-classes call to ensure node classifier
  2334.                     # has all of the classes from the puppet master before
  2335.                     # classifying PE.
  2336.                     export t_platform_puppet_class=$(platform_puppet_class) # set class from utilities for classification
  2337.                     if run "/opt/puppet/bin/ruby ${INSTALLER_DIR}/pe-classification.rb"; then
  2338.                         display 'All configurations were successfully applied!'
  2339.                     else
  2340.                         display "!!! WARNING: The node classifier was unable to apply configurations; please check the logs in '/var/log/pe-console-services/' for more information."
  2341.                         t_classification_failure='y'
  2342.                     fi
  2343.                 fi
  2344.  
  2345.             else
  2346.                 display "!!! WARNING: The node classifier could not be reached; please check the logs in '/var/log/pe-console-services/' for more information."
  2347.                 t_classification_failure='y'
  2348.             fi
  2349.  
  2350.             # Set the superuser password in RBAC to be the password supplied for dashboard auth.
  2351.             # This script depends on console-services being up and running. The wait_for_nc
  2352.             # function above is one way to ensure that RBAC will be available, so this script
  2353.             # should be after the if block above.
  2354.             if ! is_upgrade || [ "$(echo_vercmp 3.7.0 $CURRENT_PE_VERSION)" = "1" ] ; then
  2355.                 if run "/opt/puppet/bin/ruby ${INSTALLER_DIR}/update-superuser-password.rb"; then
  2356.                     echo 'Updated superuser password'
  2357.                 else
  2358.                     t_update_superuser_pass_failure='y'
  2359.                 fi
  2360.             fi
  2361.  
  2362.         fi
  2363.     fi
  2364.  
  2365.     if ! is_noop && [ y = "${q_all_in_one_install?}" ]; then
  2366.         t_wait_for_puppetdb_url="https://${q_puppetdb_hostname?}:${q_puppetdb_port?}"
  2367.         if wait_for_service $t_wait_for_puppetdb_url 120; then
  2368.             run_suppress_stdout "/opt/puppet/bin/puppet agent --test --color=false || true"
  2369.         fi
  2370.     fi
  2371.  
  2372.     #---[ Finish installation ]---------------------------------------------
  2373.     cron_enable
  2374.     run "/opt/puppet/bin/facter --puppet --yaml > /etc/puppetlabs/mcollective/facts.yaml"
  2375.     run "chown ${PLATFORM_PUPPET_USER}:${PLATFORM_PUPPET_GROUP} /etc/puppetlabs/puppet/puppet.conf"
  2376.     run "chmod 600 /etc/puppetlabs/puppet/puppet.conf"
  2377.  
  2378.     # Until we've finished upgrading all the PE nodes, agent runs will fail to
  2379.     # retrieve a fresh catalog. We need to delete the cached catalog in order
  2380.     # to avoid it reverting anything we've changed.
  2381.     run_suppress_stdout "rm -f /var/opt/lib/pe-puppet/client_data/catalog/${q_puppetagent_certname?}.json"
  2382.  
  2383.     # If this is a master or console or puppetdb install, ignore the q_puppet_agent_first_run value
  2384.     if is_pe_service_install || [ y = "${q_puppet_agent_first_run:-"y"}" ] ; then
  2385.         # NONPORTABLE
  2386.         case "${PLATFORM_NAME?}" in
  2387.             amazon | centos | rhel | sles | aix | eos)
  2388.                 bounce_service 'pe-puppet'
  2389.                 enable_service 'pe-puppet'
  2390.                 ;;
  2391.             ubuntu | debian | cumulus)
  2392.                 run "printf \"START=true\nDAEMON_OPTS=''\n\" > /etc/default/pe-puppet"
  2393.                 bounce_service 'pe-puppet'
  2394.                 enable_service 'pe-puppet'
  2395.                 ;;
  2396.             solaris)
  2397.                 if [ "${PLATFORM_RELEASE?}" = "10" ] ; then
  2398.                   if [ ! -d /etc/puppetlabs ]; then
  2399.                       run_suppress_stdout "mkdir /etc/puppetlabs"
  2400.                       run_suppress_stdout "chown ${PLATFORM_ROOT_USER}:${PLATFORM_ROOT_GROUP} /etc/puppetlabs"
  2401.                       run_suppress_stdout "chmod 755 /etc/puppetlabs"
  2402.                   fi
  2403.                   run_suppress_stdout "/usr/sbin/svccfg import /var/svc/manifest/network/pe-puppet.xml"
  2404.                   run_suppress_stdout "/usr/sbin/svcadm enable svc:/network/pe-puppet:default"
  2405.                 else
  2406.                   # We deliver the manifest and puppet.conf as part of the
  2407.                   # pe-puppet package on Solaris 11, so no need to create their
  2408.                   # directories.  Service manifest import happens as part of
  2409.                   # package installation, so we only need to enable it.
  2410.                   run_suppress_stdout "/usr/sbin/svcadm enable svc:/network/pe-puppet:default"
  2411.                 fi
  2412.                 ;;
  2413.             *)
  2414.                 display_failure "Do not know how to start puppet agent service on this platform"
  2415.                 ;;
  2416.         esac
  2417.     fi
  2418.  
  2419.     if [ y = "${q_puppet_enterpriseconsole_install}" ]; then
  2420.         if run_suppress_stdout "getent hosts ${q_public_hostname?}"; then
  2421.             t_is_hostname_resolvable='y'
  2422.         else
  2423.             t_is_hostname_resolvable='n'
  2424.         fi
  2425.     fi
  2426.  
  2427.     display_step 'DONE'
  2428.     if is_upgrade; then
  2429.         display 'Thanks for upgrading Puppet Enterprise!'
  2430.     else
  2431.         display 'Thanks for installing Puppet Enterprise!'
  2432.     fi
  2433.  
  2434.     display_newline
  2435.  
  2436.     if [ ! y = "${q_all_in_one_install}" ] ; then
  2437.         if is_upgrade ; then
  2438.             t_upgrade_or_install="upgrade"
  2439.         else
  2440.             t_upgrade_or_install="installation"
  2441.         fi
  2442.  
  2443.         if [ y = "${q_puppetdb_install?}" ] ; then
  2444.             echo "You have completed the ${t_upgrade_or_install?} of PuppetDB.  You should now complete your ${t_upgrade_or_install?} by installing or upgrading the Puppet Enterprise Console. See the documentation for more assistance: http://docs.puppetlabs.com/pe/latest" | display_wrapped_text
  2445.             display_newline
  2446.             display_newline
  2447.  
  2448.         elif [ y = "${q_puppetmaster_install?}" ] ; then
  2449.             if is_upgrade; then
  2450.                 echo "You have completed the upgrade of the puppet master, you should now proceed to upgrade PuppetDB. See the documentation for further assistance: http://docs.puppetlabs.com/pe/latest The PuppetDB node MUST be upgraded prior to installing the Console." | display_wrapped_text
  2451.             else
  2452.                 echo "You have completed the installation of the puppet master, you should now proceed to install PuppetDB on a unique node. See the documentation for further assistance: http://docs.puppetlabs.com/pe/latest The PuppetDB node MUST be installed prior to installing the Console." | display_wrapped_text
  2453.             fi
  2454.             display_newline
  2455.             display_newline
  2456.         fi
  2457.     fi
  2458.  
  2459.     echo "To learn more and get started using Puppet Enterprise, refer to the Puppet Enterprise Quick Start Guide (http://docs.puppetlabs.com/pe/latest/quick_start.html) and the Puppet Enterprise Deployment Guide (http://docs.puppetlabs.com/guides/deployment_guide/index.html)." | display_wrapped_text
  2460.     display_newline
  2461.     display_newline
  2462.  
  2463.     # on an enterprise console install
  2464.     if [ y = "${q_puppet_enterpriseconsole_install}" ]; then
  2465.         # check to see if the hostname is resolvable
  2466.         if [ n = "${t_is_hostname_resolvable?}" ]; then
  2467.             # give an error message if not
  2468.             display_newline
  2469.             echo "We could not resolve the host at ${q_public_hostname?}. If this hostname is actually correct, no further action is needed and you can disregard further error messages." | display_wrapped_text
  2470.             display_newline
  2471.         else
  2472.             # and display the console URL otherwise
  2473.             CONSOLE_URL="https://${q_public_hostname?}:${q_puppet_enterpriseconsole_httpd_port?}"
  2474.             if [ '443' = "${q_puppet_enterpriseconsole_httpd_port?}" ]; then
  2475.                 CONSOLE_URL="https://${q_public_hostname?}"
  2476.             fi
  2477.             display "   The console can be reached at the following URI:"
  2478.             display "    *  ${CONSOLE_URL?}"
  2479.             display_newline
  2480.         fi
  2481.     fi
  2482.  
  2483.     display_major_separator
  2484.     display_newline
  2485.     display_comment 'NOTES'
  2486.     display_newline
  2487.     if ! is_upgrade; then
  2488.         echo 'Puppet Enterprise has been installed to "/opt/puppet," and its configuration files are located in "/etc/puppetlabs".' | display_wrapped_text
  2489.         display_newline
  2490.         display_newline
  2491.     fi
  2492.  
  2493.     if [ ! -z "${ANSWER_FILE_TO_SAVE?}" ]; then
  2494.         echo "Answers from this session saved to '${ANSWER_FILE_TO_SAVE?}'" | display_wrapped_text
  2495.         display_newline
  2496.         if [ "y" = "${q_database_install}" ] ; then
  2497.             if is_upgrade ; then
  2498.                 t_database_info_answers="/etc/puppetlabs/installer/database_info.${PE_VERSION?}.upgrade"
  2499.             else
  2500.                 t_database_info_answers="/etc/puppetlabs/installer/database_info.install"
  2501.             fi
  2502.             echo "In addition, auto-generated database users and passwords have been saved to '${t_database_info_answers?}'" | display_wrapped_text
  2503.             display_newline
  2504.             echo "!!! WARNING: Do not discard these files! All auto-generated database users and passwords have been saved in them. You will need this information to configure the console role during installation." | display_wrapped_text
  2505.             display_newline
  2506.         fi
  2507.         display_newline
  2508.     else
  2509.         echo "!!! WARNING: An answer file could not be saved so, to prevent data loss, supplied and auto-generated database users' passwords have been saved to '/etc/puppetlabs/installer/database_info.install'. This file should be secured as soon as possible!" | display_wrapped_text
  2510.         display_newline
  2511.         display_newline
  2512.     fi
  2513.     # XXX Don't warn about ports for now. Too lazy to do anything about the console port.
  2514.     if ! is_upgrade; then
  2515.         warn_open_ports
  2516.         display_newline
  2517.     fi
  2518.  
  2519.     # If the wait_for_nc function fails to get a class update, the installer won't be able to
  2520.     # classify PE. Make sure the user knows this.
  2521.     if [ "${t_classification_failure}" == 'y' ]; then
  2522.         # make this better
  2523.         echo "!!! WARNING: Installer failed to classify Puppet Enterprise. Puppet Enterprise will not be able to manage itself because of this. Check '/var/log/pe-console-services/' for more information." | display_wrapped_text
  2524.         display_newline
  2525.     fi
  2526.  
  2527.     if [ "${t_update_superuser_pass_failure}" == 'y' ]; then
  2528.         # make this better
  2529.         echo "!!! WARNING: Installer failed to update superuser password. This leaves your PE installation at risk. Check '/var/log/pe-console-services/' for more information. Log into the console (user: admin, password: admin) as soon as possible and change the admin users password through the console." | display_wrapped_text
  2530.         display_newline
  2531.         puppet_resource "service pe-console-services ensure=stopped"
  2532.     fi
  2533.  
  2534.     if [ "${t_import_classification_failure}" == 'y' ];then
  2535.         echo "!!! WARNING: Installer failed to upgrade classification. Check '/var/log/pe-console-services/' for more information." | display_wrapped_text
  2536.         display_newline
  2537.         echo "Stopping pe-console-services to avoid puppet runs from failing or behaving incorrectly." | display_wrapped_text
  2538.         display_newline
  2539.         puppet_resource "service pe-console-services ensure=stopped"
  2540.     fi
  2541.     display_minor_separator
  2542.     display_newline
  2543.  
  2544.     # Clean up the stuff we exported
  2545.     unset q_public_hostname
  2546.     # Get rid of the development.log
  2547.     if [ -f "/var/log/pe-puppet-dashboard/development.log" ]; then
  2548.         run "rm -f /var/log/pe-puppet-dashboard/development.log"
  2549.     fi
  2550.  
  2551.     quit
  2552. fi
  2553.  
  2554. #===[ End ]=============================================================
  2555.  
  2556. # vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement