Ask Your Question

How is it that Exec seams to ignore "unless" and not "onlyif"

asked 2013-03-21 07:16:45 -0500

dijk039 gravatar image

updated 2013-03-21 17:13:05 -0500

Stefan gravatar image

In our puppet 2.6.17 environment (with passenger 3.0.17) I found something wierd. At least I think so ;-)

We use a manifest to deploy an application called ArcGIS. The first deployment on a clean system goes fine, but when the puppet-agent starts it's next run it gives the following (and only) error in every subsequent run:

debug: Exec[extract-arcgis-server-tarball](provider=posix): Executing check 'test -d /tmp/ArcGISServer'
debug: Executing 'test -d /tmp/ArcGISServer'
debug: Exec[extract-arcgis-server-tarball](provider=posix): Executing 'tar -xzf /tmp/ArcGISServer10_1.tar.gz -C /tmp'
debug: Executing 'tar -xzf /tmp/ArcGISServer10_1.tar.gz -C ...
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-03-26 06:47:19 -0500

dijk039 gravatar image

Hi Stefan,

Thank you for your response and recommendations. Also my apologies for my tardy answer!

The test statement seams to work fine under user arcgis when ran manually. Also when I clear the PATH variable in the environment:

[root@broprdmap02 tmp]# su arcgis
[arcgis@broprdmap02 tmp]$ ls -al /tmp
total 623796
drwxrwxrwt. 15 root   root          4096 Mar 26 11:36 .
dr-xr-xr-x. 23 root   root          4096 Mar 20 10:42 ..
dr-xr-xr-x.  5 arcgis arcgis        4096 Oct 24 00:34 ArcGISServer
-rwxr-xr-x.  1 arcgis arcgis   638661829 Mar 26 09:07 ArcGISServer10_1.tar.gz
drwxrwxrwt.  2 root   root          4096 Mar 20 10 ...
edit flag offensive delete link more

answered 2013-03-21 16:15:48 -0500

Stefan gravatar image

updated 2013-03-22 04:22:58 -0500

When you use onlyif, will puppet also untar your file if the directory does not exists? I suspect that your check always returns with a non zero exitcode, so puppet will always extract your file if you use unless and will never extract your file if you use onlyif.

Right now I can think of two options why your test is failing:

  1. the test command cannot be found: I recommend to always use absolute pathnames
  2. the checks do run under the same environment/user context as the final command. So in your case the test will run as the user ...
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-03-21 07:16:45 -0500

Seen: 4,697 times

Last updated: Mar 26 '13