Ask Your Question

Fetching program exit status by facter

asked 2016-03-16 18:46:14 -0600

penedo gravatar image

I'm looking to check whether the Java package is installed on OSX by executing pkgutil --pkgs=.+Java.+ and looking at its exit status.

Based on that, I'll decide whether I should execute java -version. Executing java -version when the package is not installed will result in an error (it prints some message about having to install Java).

I'm looking for the "right" way to fetch the exit code while executing the fact's setcode block.

Is there such a way?

(in case this matters, the context of this is that I want to port the puppetlabs-java module to OSX based on code from, since I can't install both modules in parallel).

edit retag flag offensive close merge delete



Ah thanks. Our Puppetfile was pinning this module to 1.4.1 and this change was made on the next version. Thanks.

penedo gravatar imagepenedo ( 2016-03-18 07:44:45 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-18 07:45:39 -0600

penedo gravatar image

@lavaman's comment is the answer - it was implemented in the next release of the module after the one I was using.

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: 2016-03-16 18:46:14 -0600

Seen: 162 times

Last updated: Mar 18 '16