inspec-compliance: url_encode profile names

This commit is contained in:
Stephan Renatus 2016-03-23 16:40:01 +01:00 committed by Dominik Richter
parent 62cadd0aab
commit be93f25e6e

View file

@ -3,6 +3,7 @@
# author: Dominik Richter
require 'thor'
require 'erb'
module Compliance
class ComplianceCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
@ -106,9 +107,10 @@ module Compliance
end
puts "Start upload to #{owner}/#{profile_name}"
pname = ERB::Util.url_encode(profile_name)
# upload the tar to Chef Compliance
url = "#{config['server']}/owners/#{owner}/compliance/#{profile_name}/tar"
url = "#{config['server']}/owners/#{owner}/compliance/#{pname}/tar"
puts "Uploading to #{url}"
success, msg = Compliance::API.post_file(url, config['token'], '', archive_path, config['insecure'])