summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremiah Snapp <jeremiah@chef.io>2017-11-02 14:02:11 -0400
committerJeremiah Snapp <jeremiah@chef.io>2017-11-15 11:18:09 -0500
commit896c0b7c6615318a632167748b2a38e5e05f153c (patch)
treeb7cd6034031d11d23626ae8a8086329e13c727a7
parent1eb0a06ee2640a2629b30c2a6ef0c2660812bce4 (diff)
downloadchef-896c0b7c6615318a632167748b2a38e5e05f153c.tar.gz
Change a useradd_spec test for RHEL >= 6.8 and >= 7.3jsnapp/fix_useradd_spec_test
RHEL 6.8 and 7.3 ship with a fixed `usermod` command. Reference: https://access.redhat.com/errata/RHBA-2016:0864 Reference: https://access.redhat.com/errata/RHBA-2016:2322 Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
-rw-r--r--spec/functional/resource/user/useradd_spec.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb
index e783356c9f..175809b5c0 100644
--- a/spec/functional/resource/user/useradd_spec.rb
+++ b/spec/functional/resource/user/useradd_spec.rb
@@ -646,10 +646,10 @@ describe Chef::Provider::User::Useradd, metadata do
expect(@error.message).to include("Cannot unlock the password")
end
elsif %w{rhel}.include?(OHAI_SYSTEM["platform_family"]) &&
- OHAI_SYSTEM["platform_version"].to_f == 6.8
- # usermod -U returns following message for rhel68 on s390x platforms
- # usermod: unlocking the user's password would result in a passwordless account.
- #You should set a password with usermod -p to unlock this user's password.
+ (Chef::VersionConstraint.new("~> 6.8").include?(OHAI_SYSTEM["platform_version"].to_f) || Chef::VersionConstraint.new("~> 7.3").include?(OHAI_SYSTEM["platform_version"].to_f))
+ # RHEL 6.8 and 7.3 ship with a fixed `usermod` command
+ # Reference: https://access.redhat.com/errata/RHBA-2016:0864
+ # Reference: https://access.redhat.com/errata/RHBA-2016:2322
it "errors out trying to unlock the user" do
expect(@error).to be_a(Mixlib::ShellOut::ShellCommandFailed)
expect(@error.message).to include("You should set a password")