summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-03-15 20:15:14 -0700
committerGitHub <noreply@github.com>2021-03-15 20:15:14 -0700
commit6fe052daf25515f6a48ec1a6b3dcc5f07fbe8d1c (patch)
tree2eac008595bc7e81db4a998f24ceeab93a244b34
parentf0abdb433178248e5a7f2ad87d20b48befa24b6d (diff)
parent8cfb078f2a9aa0c22f69ca1ba8b880043112de16 (diff)
downloadchef-6fe052daf25515f6a48ec1a6b3dcc5f07fbe8d1c.tar.gz
Merge pull request #11182 from ramereth/chef-16-fix-users-manage
Fix users_manage usage in kitchen-tests
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/linux.rb3
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/macos.rb4
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/windows.rb29
-rw-r--r--kitchen-tests/data_bags/users/adam.json2
4 files changed, 25 insertions, 13 deletions
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
index 7f72c0b76a..cd8c9c4d27 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
@@ -44,8 +44,11 @@ resolver_config "/etc/resolv.conf" do
search [ "chef.io" ]
end
+users_from_databag = search("users", "*:*")
+
users_manage "sysadmin" do
group_id 2300
+ users users_from_databag
action [:create]
end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
index a724c4882c..02fe196a7e 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
@@ -28,15 +28,19 @@ resolver_config "/etc/resolv.conf" do
search [ "chef.io" ]
end
+users_from_databag = search("users", "*:*")
+
users_manage "remove sysadmin" do
group_name "sysadmin"
group_id 2300
+ users users_from_databag
action [:remove]
end
users_manage "create sysadmin" do
group_name "sysadmin"
group_id 2300
+ users users_from_databag
action [:create]
end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
index 7eeb4ef5be..c04b98ea72 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
@@ -66,18 +66,23 @@ windows_audit_policy "Update Some Advanced Audit Policies to No Auditing" do
failure false
end
-users_manage "remove sysadmin" do
- group_name "sysadmin"
- group_id 2300
- action [:remove]
-end
-
-# FIXME: create is not idempotent. it fails with a windows error if this already exists.
-users_manage "create sysadmin" do
- group_name "sysadmin"
- group_id 2300
- action [:create]
-end
+# FIXME: upstream users cookbooks is currently broken on windows
+# users_from_databag = search("users", "*:*")
+#
+# users_manage "remove sysadmin" do
+# group_name "sysadmin"
+# group_id 2300
+# users users_from_databag
+# action [:remove]
+# end
+#
+# # FIXME: create is not idempotent. it fails with a windows error if this already exists.
+# users_manage "create sysadmin" do
+# group_name "sysadmin"
+# group_id 2300
+# users users_from_databag
+# action [:create]
+# end
include_recipe "::_chef_client_config"
include_recipe "::_chef_client_trusted_certificate"
diff --git a/kitchen-tests/data_bags/users/adam.json b/kitchen-tests/data_bags/users/adam.json
index f96d7c213f..ecd4b73e74 100644
--- a/kitchen-tests/data_bags/users/adam.json
+++ b/kitchen-tests/data_bags/users/adam.json
@@ -5,5 +5,5 @@
"shell": "/bin/zsh",
"groups": [ "sysadmin" ],
"comment": "Adam Jacob",
- "password": "*"
+ "password": "$6$QQk10qmDjMv.o$wHIjLH9JOxUmaJTsxYFttFhP1jZZtTk/ovhpasmQJS5mfimeFs8HMRWGWM8uBB5dhEmP6svqhRdJE5k1oWRPF1"
}