Revision d96043f5
Added by Tomer Brisker about 5 years ago
app/views/unattended/provisioning_templates/snippet/_built.erb | ||
---|---|---|
Tries curl, if not found then wget and finally wget from busybox (limited options).
|
||
-%>
|
||
<%
|
||
url = foreman_url('built')
|
||
endpoint = @endpoint || 'built'
|
||
method = @method || 'POST'
|
||
url = foreman_url(endpoint)
|
||
curl_opts = ["-H 'Content-Type: text/plain'"]
|
||
wget_opts = ["--header 'Content-Type: text/plain'"]
|
||
if url.start_with?('https')
|
||
curl_opts = "--insecure"
|
||
wget_opts = "--no-check-certificate"
|
||
else
|
||
curl_opts = ""
|
||
wget_opts = ""
|
||
curl_opts << "--insecure"
|
||
wget_opts << "--no-check-certificate"
|
||
end
|
||
if @body_file
|
||
curl_opts << "--data @#{@body_file}"
|
||
wget_opts << "--body-file=#{@body_file}"
|
||
end
|
||
-%>
|
||
if [ -x /usr/bin/curl ]; then
|
||
/usr/bin/curl -o /dev/null --noproxy \* <%= curl_opts %> --silent '<%= url %>'
|
||
/usr/bin/curl -o /dev/null --noproxy \* <%= curl_opts.join(' ') %> --silent '<%= url %>'
|
||
elif [ -x /usr/bin/wget ]; then
|
||
/usr/bin/wget -q -O /dev/null --no-proxy <%= wget_opts %> '<%= url %>'
|
||
/usr/bin/wget -q -O /dev/null --no-proxy --method <%= method %> <%= wget_opts.join(' ') %> '<%= url %>'
|
||
else
|
||
wget -q -O /dev/null '<%= url %>'
|
||
wget -q -O /dev/null --header 'Content-Type: text/plain' '<%= url %>'
|
||
fi
|
Also available in: Unified diff
templates - sync from community-templates