summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMatthaus Owens <matthaus@puppetlabs.com>2014-05-01 16:16:35 -0700
committerMatthaus Owens <matthaus@puppetlabs.com>2014-05-07 12:47:17 -0700
commitf1e7f67c61a0aa265a1c48f4e4b73b74aa50db6a (patch)
tree89551416b48289326dcc8cfcf14f04c4d672e27d /ext
parent89c4e126872c9951ddaf804c747e312485bff787 (diff)
downloadpuppet-f1e7f67c61a0aa265a1c48f4e4b73b74aa50db6a.tar.gz
(PUP-2395) Refactor puppetmaster-postinst sed calls
This commit brings over a change from the debian puppet packaging to move all of the sed calls in to one sed invocation and to use a tempfile instead of operating directly on the live apache vhost file.
Diffstat (limited to 'ext')
-rw-r--r--ext/debian/puppetmaster-passenger.postinst22
1 files changed, 11 insertions, 11 deletions
diff --git a/ext/debian/puppetmaster-passenger.postinst b/ext/debian/puppetmaster-passenger.postinst
index 08103eaf6..b21af7f61 100644
--- a/ext/debian/puppetmaster-passenger.postinst
+++ b/ext/debian/puppetmaster-passenger.postinst
@@ -64,17 +64,17 @@ if [ "$1" = "configure" ]; then
# Setup apache2 configuration files
APACHE2_SITE_FILE="/etc/apache2/sites-available/$(apache2_puppetmaster_sitename)"
if [ ! -e "${APACHE2_SITE_FILE}" ]; then
- cp /usr/share/puppetmaster-passenger/apache2.site.conf.tmpl "${APACHE2_SITE_FILE}"
- # Fix path to SSL files
- sed -r -i "s|(SSLCertificateFile\s+).+$|\1$(puppet master --configprint hostcert)|" "${APACHE2_SITE_FILE}"
- sed -r -i "s|(SSLCertificateKeyFile\s+).+$|\1$(puppet master --configprint hostprivkey)|" "${APACHE2_SITE_FILE}"
- sed -r -i "s|(SSLCACertificateFile\s+).+$|\1$(puppet master --configprint localcacert)|" "${APACHE2_SITE_FILE}"
- sed -r -i "s|(SSLCertificateChainFile\s+).+$|\1$(puppet master --configprint localcacert)|" "${APACHE2_SITE_FILE}"
- sed -r -i "s|(SSLCARevocationFile\s+).+$|\1$(puppet master --configprint cacrl)|" "${APACHE2_SITE_FILE}"
-
- # Fix path to rack docroot and directory
- sed -r -i "s|DocumentRoot /etc/puppet/rack/public|DocumentRoot /usr/share/puppet/rack/puppetmasterd/public|g" "${APACHE2_SITE_FILE}"
- sed -r -i "s|<Directory /etc/puppet/rack/>|<Directory /usr/share/puppet/rack/puppetmasterd/>|g" "${APACHE2_SITE_FILE}"
+ tempfile=$(mktemp)
+ sed -r \
+ -e "s|(SSLCertificateFile\s+).+$|\1$(puppet master --configprint hostcert)|" \
+ -e "s|(SSLCertificateKeyFile\s+).+$|\1$(puppet master --configprint hostprivkey)|" \
+ -e "s|(SSLCACertificateFile\s+).+$|\1$(puppet master --configprint localcacert)|" \
+ -e "s|(SSLCertificateChainFile\s+).+$|\1$(puppet master --configprint localcacert)|" \
+ -e "s|(SSLCARevocationFile\s+).+$|\1$(puppet master --configprint cacrl)|" \
+ -e "s|DocumentRoot /etc/puppet/rack/public|DocumentRoot /usr/share/puppet/rack/puppetmasterd/public|" \
+ -e "s|<Directory /etc/puppet/rack/>|<Directory /usr/share/puppet/rack/puppetmasterd/>|" \
+ /usr/share/puppetmaster-passenger/apache2.site.conf.tmpl > $tempfile
+ mv $tempfile "${APACHE2_SITE_FILE}"
fi
# Enable needed modules