Skip to content

Commit

Permalink
Revert "(PUP-3632) Update paths and defaults for the unified agent la…
Browse files Browse the repository at this point in the history
…yout"
  • Loading branch information
whopper committed Feb 3, 2015
1 parent d6888a4 commit 2270553
Show file tree
Hide file tree
Showing 26 changed files with 194 additions and 277 deletions.
90 changes: 45 additions & 45 deletions acceptance/lib/puppet/acceptance/environment_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,95 +49,95 @@ def [](param)
let(:host) { TestHost.new(directory_contents, 'user' => 'root', 'group' => 'puppet') }
let(:directory_contents) do
{
'/etc/puppetlabs' => 'foo bar baz widget',
'/etc/puppet' => 'foo bar baz widget',
'/tmp/dir' => 'foo dingo bar thing',
}
end

it "runs the block of code" do
ran_code = false
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppetlabs', '/tmp/dir') do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppet', '/tmp/dir') do
ran_code = true
end
expect(ran_code).to be true
expect(host.did).to eq([
"ls /etc/puppetlabs",
"ls /etc/puppet",
"ls /tmp/dir",
"mv /etc/puppetlabs/foo /etc/puppetlabs/foo.bak",
"mv /etc/puppetlabs/bar /etc/puppetlabs/bar.bak",
"cp -R /tmp/dir/foo /etc/puppetlabs/foo",
"cp -R /tmp/dir/dingo /etc/puppetlabs/dingo",
"cp -R /tmp/dir/bar /etc/puppetlabs/bar",
"cp -R /tmp/dir/thing /etc/puppetlabs/thing",
"chown -R root:puppetlabs /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"chmod -R 770 /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"rm -rf /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"mv /etc/puppetlabs/foo.bak /etc/puppetlabs/foo",
"mv /etc/puppetlabs/bar.bak /etc/puppetlabs/bar"
"mv /etc/puppet/foo /etc/puppet/foo.bak",
"mv /etc/puppet/bar /etc/puppet/bar.bak",
"cp -R /tmp/dir/foo /etc/puppet/foo",
"cp -R /tmp/dir/dingo /etc/puppet/dingo",
"cp -R /tmp/dir/bar /etc/puppet/bar",
"cp -R /tmp/dir/thing /etc/puppet/thing",
"chown -R root:puppet /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
"chmod -R 770 /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
"rm -rf /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
"mv /etc/puppet/foo.bak /etc/puppet/foo",
"mv /etc/puppet/bar.bak /etc/puppet/bar"
])
end

it "backs up the original items that are shadowed by tmp items" do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppetlabs', '/tmp/dir') {}
expect(host.did.grep(%r{mv /etc/puppetlabs/\w+ })).to eq([
"mv /etc/puppetlabs/foo /etc/puppetlabs/foo.bak",
"mv /etc/puppetlabs/bar /etc/puppetlabs/bar.bak",
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppet', '/tmp/dir') {}
expect(host.did.grep(%r{mv /etc/puppet/\w+ })).to eq([
"mv /etc/puppet/foo /etc/puppet/foo.bak",
"mv /etc/puppet/bar /etc/puppet/bar.bak",
])
end

it "copies in all the tmp items into the working dir" do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppetlabs', '/tmp/dir') {}
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppet', '/tmp/dir') {}
expect(host.did.grep(%r{cp})).to eq([
"cp -R /tmp/dir/foo /etc/puppetlabs/foo",
"cp -R /tmp/dir/dingo /etc/puppetlabs/dingo",
"cp -R /tmp/dir/bar /etc/puppetlabs/bar",
"cp -R /tmp/dir/thing /etc/puppetlabs/thing",
"cp -R /tmp/dir/foo /etc/puppet/foo",
"cp -R /tmp/dir/dingo /etc/puppet/dingo",
"cp -R /tmp/dir/bar /etc/puppet/bar",
"cp -R /tmp/dir/thing /etc/puppet/thing",
])
end

it "opens the permissions on all copied files to 770 and sets ownership based on host settings" do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppetlabs', '/tmp/dir') {}
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppet', '/tmp/dir') {}
expect(host.did.grep(%r{ch(mod|own)})).to eq([
"chown -R root:puppet /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"chmod -R 770 /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"chown -R root:puppet /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
"chmod -R 770 /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
])
end

it "deletes all the tmp items from the working dir" do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppetlabs', '/tmp/dir') {}
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppet', '/tmp/dir') {}
expect(host.did.grep(%r{rm})).to eq([
"rm -rf /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"rm -rf /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
])
end

it "replaces the original items that had been shadowed into the working dir" do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppetlabs', '/tmp/dir') {}
expect(host.did.grep(%r{mv /etc/puppetlabs/\w+\.bak})).to eq([
"mv /etc/puppetlabs/foo.bak /etc/puppetlabs/foo",
"mv /etc/puppetlabs/bar.bak /etc/puppetlabs/bar"
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppet', '/tmp/dir') {}
expect(host.did.grep(%r{mv /etc/puppet/\w+\.bak})).to eq([
"mv /etc/puppet/foo.bak /etc/puppet/foo",
"mv /etc/puppet/bar.bak /etc/puppet/bar"
])
end

it "always cleans up, even if the code we yield to raises an error" do
expect do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppetlabs', '/tmp/dir') do
testcase.safely_shadow_directory_contents_and_yield(host, '/etc/puppet', '/tmp/dir') do
raise 'oops'
end
end.to raise_error('oops')
expect(host.did).to eq([
"ls /etc/puppetlabs",
"ls /etc/puppet",
"ls /tmp/dir",
"mv /etc/puppetlabs/foo /etc/puppetlabs/foo.bak",
"mv /etc/puppetlabs/bar /etc/puppetlabs/bar.bak",
"cp -R /tmp/dir/foo /etc/puppetlabs/foo",
"cp -R /tmp/dir/dingo /etc/puppetlabs/dingo",
"cp -R /tmp/dir/bar /etc/puppetlabs/bar",
"cp -R /tmp/dir/thing /etc/puppetlabs/thing",
"chown -R root:puppetlabs /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"chmod -R 770 /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"rm -rf /etc/puppetlabs/foo /etc/puppetlabs/dingo /etc/puppetlabs/bar /etc/puppetlabs/thing",
"mv /etc/puppetlabs/foo.bak /etc/puppetlabs/foo",
"mv /etc/puppetlabs/bar.bak /etc/puppetlabs/bar"
"mv /etc/puppet/foo /etc/puppet/foo.bak",
"mv /etc/puppet/bar /etc/puppet/bar.bak",
"cp -R /tmp/dir/foo /etc/puppet/foo",
"cp -R /tmp/dir/dingo /etc/puppet/dingo",
"cp -R /tmp/dir/bar /etc/puppet/bar",
"cp -R /tmp/dir/thing /etc/puppet/thing",
"chown -R root:puppet /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
"chmod -R 770 /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
"rm -rf /etc/puppet/foo /etc/puppet/dingo /etc/puppet/bar /etc/puppet/thing",
"mv /etc/puppet/foo.bak /etc/puppet/foo",
"mv /etc/puppet/bar.bak /etc/puppet/bar"
])
end
end
Expand Down
6 changes: 3 additions & 3 deletions acceptance/lib/puppet/acceptance/module_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module ModuleUtils
# Example return value:
#
# [
# "/etc/puppetlabs/agent/environments/production/modules",
# "/etc/puppetlabs/agent/modules",
# "/opt/puppetlabs/agent/modules",
# "/etc/puppetlabs/puppet/environments/production/modules",
# "/etc/puppetlabs/puppet/modules",
# "/opt/puppet/share/puppet/modules",
# ]
#
# @param host [String] hostname
Expand Down
2 changes: 1 addition & 1 deletion acceptance/setup/git/pre-suite/030_PuppetMasterSanity.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_name "Puppet Master sanity checks: PID file and SSL dir creation"

pidfile = '/var/run/puppetlabs/master.pid'
pidfile = '/var/lib/puppet/run/master.pid'

hostname = on(master, 'facter hostname').stdout.strip
fqdn = on(master, 'facter fqdn').stdout.strip
Expand Down
9 changes: 0 additions & 9 deletions conf/puppet.conf

This file was deleted.

1 change: 0 additions & 1 deletion ext/debian/puppet.conf

This file was deleted.

14 changes: 14 additions & 0 deletions ext/debian/puppet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=$vardir/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates

[master]
# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY

2 changes: 1 addition & 1 deletion ext/debian/puppet.init
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DAEMON_OPTS=""
NAME="agent"
PROCNAME="puppet"
DESC="puppet agent"
PIDFILE="/var/run/puppetlabs/${NAME}.pid"
PIDFILE="/var/run/puppet/${NAME}.pid"

test -x $DAEMON || exit 0

Expand Down
10 changes: 5 additions & 5 deletions ext/debian/puppetmaster.init
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [ ! -d /var/run/puppet ]; then
mkdir -p /var/run/puppet
fi

chown puppet:puppet /var/run/puppetlabs
chown puppet:puppet /var/run/puppet

mongrel_warning="The mongrel servertype is no longer built-in to Puppet. It
appears as though mongrel is being used, as the number of puppetmasters is
Expand All @@ -49,7 +49,7 @@ is_true() {

start_puppet_master() {
if is_true "$START" ; then
start-stop-daemon --start --quiet --pidfile /var/run/puppetlabs/${NAME}.pid \
start-stop-daemon --start --quiet --pidfile /var/run/puppet/${NAME}.pid \
--startas $DAEMON -- $NAME $DAEMON_OPTS --masterport=$PORT
else
echo ""
Expand All @@ -58,7 +58,7 @@ start_puppet_master() {
}

stop_puppet_master() {
start-stop-daemon --stop --retry TERM/10/KILL/5 --quiet --oknodo --pidfile /var/run/puppetlabs/${NAME}.pid
start-stop-daemon --stop --retry TERM/10/KILL/5 --quiet --oknodo --pidfile /var/run/puppet/${NAME}.pid
}

status_puppet_master() {
Expand Down Expand Up @@ -96,11 +96,11 @@ status_puppet_master() {
fi

if is_true "$START" ; then
status_of_proc -p "/var/run/puppetlabs/${NAME}.pid" "${DAEMON}" "${NAME}"
status_of_proc -p "/var/run/puppet/${NAME}.pid" "${DAEMON}" "${NAME}"
else
echo ""
echo "puppetmaster not configured to start"
status_of_proc -p "/var/run/puppetlabs/${NAME}.pid" "${DAEMON}" "${NAME}"
status_of_proc -p "/var/run/puppet/${NAME}.pid" "${DAEMON}" "${NAME}"
fi
}

Expand Down
2 changes: 1 addition & 1 deletion ext/gentoo/conf.d/puppet
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Location of PID files
PUPPET_PID_DIR="/var/run/puppetlabs"
PUPPET_PID_DIR="/var/run/puppet"

# You may specify other parameters to the puppet client here
#PUPPET_EXTRA_OPTS=""
2 changes: 1 addition & 1 deletion ext/gentoo/conf.d/puppetmaster
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Location of PID files
PUPPETMASTER_PID_DIR="/var/run/puppetlabs"
PUPPETMASTER_PID_DIR="/var/run/puppet"

# Location of the main manifest
#PUPPETMASTER_MANIFEST="/etc/puppet/manifests/site.pp"
Expand Down
1 change: 0 additions & 1 deletion ext/gentoo/puppet/puppet.conf

This file was deleted.

20 changes: 20 additions & 0 deletions ext/gentoo/puppet/puppet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

[puppetd]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt
1 change: 0 additions & 1 deletion ext/ips/puppet.conf

This file was deleted.

23 changes: 23 additions & 0 deletions ext/ips/puppet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

[main]
vardir = /var/lib/puppet

# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt
2 changes: 1 addition & 1 deletion ext/redhat/client.init
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export PATH

[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
lockfile=${LOCKFILE-/var/lock/subsys/puppet}
pidfile=${PIDFILE-/var/run/puppetlabs/agent.pid}
pidfile=${PIDFILE-/var/run/puppet/agent.pid}
puppetd=${PUPPETD-/usr/bin/puppet}
RETVAL=0

Expand Down
1 change: 0 additions & 1 deletion ext/redhat/puppet.conf

This file was deleted.

20 changes: 20 additions & 0 deletions ext/redhat/puppet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt
2 changes: 1 addition & 1 deletion ext/redhat/server.init
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

lockfile=/var/lock/subsys/puppetmaster
pidfile=/var/run/puppetlabs/master.pid
pidfile=/var/run/puppet/master.pid

# Source function library.
. /etc/rc.d/init.d/functions
Expand Down
2 changes: 1 addition & 1 deletion ext/solaris/smf/svc-puppetd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exec_prefix=/opt/csw
sysconfdir=/opt/csw/etc
sbindir=/opt/csw/sbin

pidfile=/var/run/puppetlabs/agent.pid
pidfile=/var/lib/puppet/run/agent.pid

case "$1" in
start)
Expand Down
2 changes: 1 addition & 1 deletion ext/solaris/smf/svc-puppetmasterd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exec_prefix=/opt/csw
sysconfdir=/opt/csw/etc
sbindir=/opt/csw/sbin

pidfile=/var/run/puppetlabs/master.pid
pidfile=/var/lib/puppet/run/master.pid

case "$1" in
start)
Expand Down
2 changes: 1 addition & 1 deletion ext/suse/client.init
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[ -f /etc/rc.status ] && . /etc/rc.status
[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
lockfile=${LOCKFILE-/var/lock/subsys/puppet}
pidfile=${PIDFILE-/var/run/puppetlabs/agent.pid}
pidfile=${PIDFILE-/var/run/puppet/agent.pid}
puppetd=${PUPPETD-/usr/bin/puppet}
RETVAL=0

Expand Down
2 changes: 1 addition & 1 deletion ext/suse/server.init
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# rc_exit exit appropriate to overall rc status

lockfile=/var/lock/subsys/puppetmaster
pidfile=/var/run/puppetlabs/master.pid
pidfile=/var/run/puppet/master.pid

# Source function library.
[ -f /etc/rc.status ] && . /etc/rc.status
Expand Down
Loading

0 comments on commit 2270553

Please sign in to comment.