lib/chef-api/resources/user.rb in chef-api-0.10.7 vs lib/chef-api/resources/user.rb in chef-api-0.10.10
- old
+ new
@@ -1,7 +1,9 @@
module ChefAPI
class Resource::User < Resource::Base
+ require "cgi" unless defined?(CGI)
+
collection_path "/users"
schema do
flavor :enterprise do
attribute :username, type: String, primary: true, required: true
@@ -36,10 +38,10 @@
users = collection(prefix)
# HEC/EC returns a slightly different response than OSC/CZ
if users.is_a?(Array)
users.each do |info|
- name = URI.escape(info["user"]["username"])
+ name = CGI.escape(info["user"]["username"])
response = connection.get("/users/#{name}")
result = from_json(response, prefix)
block.call(result) if block
end