Ask Your Question
0

Fetching program exit status by facter

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

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 https://github.com/skoblenick/puppet-..., since I can't install both modules in parallel).

edit retag flag offensive close merge delete

Comments

1
1

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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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

2 followers

Stats

Asked: 2016-03-16 18:46:14 -0500

Seen: 84 times

Last updated: Mar 18 '16