Properly handle HTTP 301 redirection.

This commit is contained in:
Kazuhiro MUSASHI 2022-10-15 10:49:11 +09:00
parent 1943fb5f09
commit a00dd97b81
8 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
vtag = $1 if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
tag = vtag.sub(/^v/, '')
gitea_bin = "#{node['gitea']['prefix']}#{tag}#{node['gitea']['postfix']}"

View File

@ -13,7 +13,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
vtag = $1 if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
tag = vtag.sub(/^v/, '')
loki_bin = "#{node['loki']['zip']}"

View File

@ -38,7 +38,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
vtag = $1
tag_version = vtag.sub('v', '')

View File

@ -24,7 +24,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
vtag = $1
tag_version = vtag.sub('v', '')

View File

@ -13,7 +13,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
vtag = $1 if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
tag = vtag.sub(/^v/, '')
alertmanager_bin = "#{node['alertmanager']['prefix']}#{tag}#{node['alertmanager']['postfix']}"

View File

@ -12,7 +12,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
tag = $1 if response.body =~ %r{tag\/(\d+\.\d+)}
tag = $1 if response['location'] =~ %r{tag\/(\d+\.\d+)}
alertmanager_webhook_bin = "#{node['alertmanager_webhook']['prefix']}#{tag}#{node['alertmanager_webhook']['postfix']}"

View File

@ -13,7 +13,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
vtag = $1 if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
tag = vtag.sub(/^v/, '')
prometheus_bin = "#{node['prometheus']['prefix']}#{tag}#{node['prometheus']['postfix']}"

View File

@ -13,7 +13,7 @@ begin
Timeout.timeout(3) do
response = Net::HTTP.get_response(uri)
vtag = $1 if response.body =~ %r{tag\/(v\d+\.\d+\.\d+)}
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
tag = vtag.sub(/^v/, '')
snmp_bin = "#{node['snmp_exporter']['prefix']}#{tag}#{node['snmp_exporter']['postfix']}"