Skip to content

Commit

Permalink
make sudoversion fact more robust
Browse files Browse the repository at this point in the history
Depending on the locale of the system, 'sudo -V' doesn't output exactly
the same string. Since we're parsing that string using a regex, we need
to plan for these differences.
  • Loading branch information
ckaenzig committed Sep 24, 2012
1 parent 450b6e9 commit 432d2b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/facter/sudo.rb
@@ -1,6 +1,6 @@
output = %x{sudo -V 2>&1} output = %x{sudo -V 2>&1}


if $?.exitstatus and output.match(/Sudo version ([\d\.]+)/) if $?.exitstatus and output.match(/[Ss]udo[ \-][Vv]ersion ([\d\.]+)/)


Facter.add("sudoversion") do Facter.add("sudoversion") do
setcode do setcode do
Expand Down

0 comments on commit 432d2b9

Please sign in to comment.