Skip to content

Commit

Permalink
Convert per_page in foreman::foreman to string
Browse files Browse the repository at this point in the history
CGI.escape can only deal with strings and the function accepts per_page
as an integer.
  • Loading branch information
ekohl committed Oct 28, 2022
1 parent e75710c commit fbbfdd2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/functions/foreman/foreman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def foreman(item, search, per_page = "20", foreman_url = "https://localhost", fo
raise Puppet::ParseError, "Foreman: Invalid filter_result: #{filter_result}, must not be boolean true" if filter_result == true

begin
path = "/api/#{CGI.escape(item)}?search=#{CGI.escape(search)}&per_page=#{CGI.escape(per_page)}"
path = "/api/#{CGI.escape(item)}?search=#{CGI.escape(search)}&per_page=#{CGI.escape(per_page.to_s)}"

req = Net::HTTP::Get.new(path)
req['Content-Type'] = 'application/json'
Expand Down

0 comments on commit fbbfdd2

Please sign in to comment.