On Thursday, August 23, 2012 7:56:38 AM UTC-5, André Fernandes wrote: > > Thanks for the insight. > > I've been investigating a bit deeper and found that this is likely an > issue with the build of apache I'm using. > > I've run into the same problem with a "squid version" facter script and > found that, in the affected hosts, the squid binary had been compiled with > the --enable-ssl --with-openssl=/usr/local/ssl flags. The directory > specified in the --with-openssl option is not correct, which makes the > execution fail when invoking in a non-interactive shell. I could not verify > the compile flags for apache, but it's likely a similar scenario. > > Curiously enough, Facter::Util::Resolution.exec doesn't seem to like > shell contructs like ';' and '.' (sourcing a script). I've found that > sourcing the .profile file ('. /home/apache/.profile /usr/bin/squid -v') in > a non-interactive shell makes it possible to execute the binaries, since it > sets all the environment variables that are present in an interactive > shell, but running it inside Facter::Util::Resolution.exec has no result > (the command aborts with no output). > The 'VAR=value some_command' trick won't work either. > > I'm running facter 1.5.8, could this be a bug or am I misinterpreting > something? >
I don't know about Facter 1.5.8 specifically, but I'm looking at the code for the 1.6.x series, and basically it passes your command to a subshell by means of Ruby's %x{} construct. That does mean you're probably getting /bin/sh, which may alter behavior a bit vs. bash, even if it's an alias for /bin/bash. Facter does not appear to expect variable assignments before the command, but it doesn't look like that should be a problem in itself as long as the command is absolute (better) or in the search path. If you turn on debug logging then perhaps it will give you more information on what's happening. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/kuQpaqqa_K4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.