(SERVER-404) Create empty /var/run/puppet directory #422

Merged
merged 3 commits into from Mar 11, 2015

Projects

None yet

5 participants

@dankreek
Contributor
dankreek commented Mar 6, 2015

Create an empty /var/run/puppet directory before starting up puppet server

@dankreek
Contributor
dankreek commented Mar 6, 2015

Note that packaging won't be buildable until the release of EZ-bake 0.2.4

@elyscape
Contributor
elyscape commented Mar 7, 2015

This doesn't actually empty out /var/run/puppet. Or was "Create and empty" a typo for "Create an empty"?

I realize this sounds sarcastic but it's meant genuinely.

@dankreek
Contributor
dankreek commented Mar 7, 2015

It was a typo. Thanks.

@jeffmccune jeffmccune and 3 others commented on an outdated diff Mar 9, 2015
resources/ext/ezbake.conf
@@ -21,7 +21,8 @@ ezbake: {
"mkdir -p /etc/puppet/manifests"],
install: ["echo \\\"os-settings: {\\\" > $DESTDIR/$projconfdir/conf.d/os-settings.conf",
"echo \\\" ruby-load-path: [$rubylibdir]\\\" >> $DESTDIR/$projconfdir/conf.d/os-settings.conf",
- "echo \\\"}\\\" >> $DESTDIR/$projconfdir/conf.d/os-settings.conf" ]
+ "echo \\\"}\\\" >> $DESTDIR/$projconfdir/conf.d/os-settings.conf" ],
+ pre-start-action: ["install --group={{user}} --owner={{user}} -d /var/run/puppet"]
@jeffmccune
jeffmccune Mar 9, 2015 Contributor

Will this action execute every time the service starts, or only on package installation? If it doesn't execute every time the service starts it might be better to move out of packaging and into the service management behavior, e.g. the init or unit file script.

@camlow325
camlow325 Mar 9, 2015 Contributor

I think it has to execute each time the service starts, right - so that we can ensure it happens on the service startup that happens after a reboot?

@dankreek
dankreek Mar 9, 2015 Contributor

That is correct, the pre-start-actions get executed as root before starting the service.

@jeffmccune
jeffmccune Mar 9, 2015 Contributor

Yes, it does have to. It's just sometimes not super clear when actions are carried out in EZBake.

In this case, pre-start-action gets mapped to EZBake::Config[:redhat][:pre_start_action] and the actions are carried out in the init scripts and unit files themselves, not in the packages. Looks like this is what motivated EZ-31 in the first place.

https://github.com/puppetlabs/ezbake/blob/e3f9ab7fafe6770733519ec6f435d5ef01d2eca8/resources/puppetlabs/lein-ezbake/template/foss/ext/redhat/init.erb#L60-L62

@camlow325
camlow325 Mar 10, 2015 Contributor

With this pre-start-action, I get a systemd config for the puppetserver.service which has:

ExecStartPre=install --group=puppet --owner=puppet -d /var/run/puppet

I tested out an ezbake package on CentOS 7. If I delete the /var/run/puppet directory before starting the service, the directory doesn't end up getting created and so puppetserver blows up. If I modify the puppetserver.service to use this instead ...

ExecStartPre=/usr/bin/install --group=puppet --owner=puppet -d /var/run/puppet

... then the directory is created fine the next time the service starts and the service comes to ready properly.

This leads me to believe that we need to use an absolute path here -- /usr/bin/install instead of just "install". "install" lives under /usr/bin by default in the distros I tried -- CentOS 6, CentOS 7, and Debian 7.

@haus - does this path make sense to you?

@haus
haus Mar 10, 2015 Member

@camlow325 yes, Exec* in systemd need to be fully qualified. /usr/bin/install should be safe in the linuxes we support with ezbake.

@dankreek
dankreek Mar 10, 2015 Contributor

Ah shoot, I actually observed that behavior when the '-' was in front of the command, but removed it and somehow assumed the full path wasn't then necessary.

@jeffmccune jeffmccune commented on an outdated diff Mar 9, 2015
resources/ext/ezbake.conf
@@ -35,7 +36,8 @@ ezbake: {
"mkdir -p /etc/puppet/manifests"],
install: ["echo \\\"os-settings: {\\\" > $DESTDIR/$projconfdir/conf.d/os-settings.conf"
"echo \\\" ruby-load-path: [$rubylibdir]\\\" >> $DESTDIR/$projconfdir/conf.d/os-settings.conf",
- "echo \\\"}\\\" >> $DESTDIR/$projconfdir/conf.d/os-settings.conf"]
+ "echo \\\"}\\\" >> $DESTDIR/$projconfdir/conf.d/os-settings.conf"],
+ pre-start-action: ["install --group={{user}} --owner={{user}} -d /var/run/puppet"]
@jeffmccune
jeffmccune Mar 9, 2015 Contributor

Same question as above regarding when this will execute.

@dankreek
Contributor

@camlow325 added the full path to the install command

@camlow325
Contributor

👍 I'm good with this. @haus, look okay to you?

@haus
Member
haus commented Mar 11, 2015

@haus
Member
haus commented Mar 11, 2015

@dankreek will you merge up or will there be a new PR for master?

@dankreek
Contributor

Well, the master branch may actually require a different directory to be created, or maybe none at all? This work has been captured in SERVER-414

@haus
Member
haus commented Mar 11, 2015

@dankreek sweet

@camlow325
Contributor

👍

@camlow325 camlow325 merged commit d44cbb6 into puppetlabs:stable Mar 11, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment