The useradd provider has the requirement that ruby-shadow[1] be
installed to be able to manage passwords.

On systems where we would use the useradd provider and this library
has not been installed we don't bother running the test, since we will
never be able to see the output we are testing.

[1] http://ttsky.net/ruby/

Signed-off-by: Jacob Helwig <[email protected]>
Reviewed-by: Dominic Maraglia <[email protected]>
Reviewed-by: Nick Lewis <[email protected]>
---

This test was causing some problems with our testing infrastructure,
since we didn't have ruby-shadow installed on all of the Ubuntu & CentOS
nodes.  The test ended up failing since Puppet was rightfully saying
that it couldn't manage the password property without the required
library.

 ...rd-disclosure-when-changing-a-users-password.rb |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb
 
b/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb
index f1e100c..d3b4156 100644
--- 
a/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb
+++ 
b/acceptance/tests/ticket_6857_password-disclosure-when-changing-a-users-password.rb
@@ -1,5 +1,15 @@
 test_name "#6857: redact password hashes when applying in noop mode"
 
+hosts_to_test = agents.reject do |agent|
+  if agent['platform'].match /(?:ubuntu|centos|debian|rhel)/
+    result = on(agent, %q{ruby -e 'require "shadow" or raise'}, :silent => 
true)
+    result.exit_code != 0
+  else
+    false
+  end
+end
+skip_test "No suitable hosts found" if hosts_to_test.empty?
+
 adduser_manifest = <<MANIFEST
 user { 'passwordtestuser':
   ensure   => 'present',
@@ -15,9 +25,9 @@ user { 'passwordtestuser':
 }
 MANIFEST
 
-apply_manifest_on(agents, adduser_manifest )
-results = apply_manifest_on(agents, changepass_manifest )
+apply_manifest_on(hosts_to_test, adduser_manifest )
+results = apply_manifest_on(hosts_to_test, changepass_manifest )
 
 results.each do |result|
-  assert_match( /current_value \[old password hash redacted\], should be \[new 
password hash redacted\]/ , "#{result.stdout}" )
+  assert_match( /current_value \[old password hash redacted\], should be \[new 
password hash redacted\]/ , "#{result.host}: #{result.stdout}" )
 end
-- 
1.7.6

-- 
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.

Reply via email to