On 7 March 2011 09:25, James Turnbull <[email protected]> wrote:
>
> Signed-off-by: James Turnbull <[email protected]>
This fact probably could do with a unittest - there is selinux_spec.rb
already and you should be able to add the missing test as you are
touching it.
Perhaps use Resolution::Exec rather than %x{}
We also should enforce the no-trailing whitespace rules in the facter
lib not in each individual fact. I personally dislike the use of pipes
in the fact as we can't unittest the logic, and would rather it be
handled in ruby rather than grep/awk.
Paul
Paul
> ---
> Local-branch: tickets/master/5485
> lib/facter/selinux.rb | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/facter/selinux.rb b/lib/facter/selinux.rb
> index 0e9637d..d312b3b 100644
> --- a/lib/facter/selinux.rb
> +++ b/lib/facter/selinux.rb
> @@ -4,7 +4,7 @@
> Facter.add("selinux") do
> confine :kernel => :linux
>
> - setcode do
> + setcode do
> result = "false"
> if FileTest.exists?("/selinux/enforce")
> if FileTest.exists?("/proc/self/attr/current")
> @@ -31,7 +31,7 @@ end
>
> Facter.add("selinux_policyversion") do
> confine :selinux => :true
> - setcode do
> + setcode do
> File.read("/selinux/policyvers")
> end
> end
> @@ -39,7 +39,7 @@ end
> Facter.add("selinux_mode") do
> confine :selinux => :true
> setcode do
> - %x{/usr/sbin/sestatus | /bin/grep "Policy from config file:" | awk
> '{print $5}'}
> + %x{/usr/sbin/sestatus | /bin/grep "Policy from config file:" | awk
> '{print $5}'}.chomp
> end
> end
>
> --
> 1.7.1
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.