Properly handle HTTP 301 redirection.
This commit is contained in:
parent
1943fb5f09
commit
a00dd97b81
|
@ -13,7 +13,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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/, '')
|
tag = vtag.sub(/^v/, '')
|
||||||
|
|
||||||
gitea_bin = "#{node['gitea']['prefix']}#{tag}#{node['gitea']['postfix']}"
|
gitea_bin = "#{node['gitea']['prefix']}#{tag}#{node['gitea']['postfix']}"
|
||||||
|
|
|
@ -13,7 +13,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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/, '')
|
tag = vtag.sub(/^v/, '')
|
||||||
|
|
||||||
loki_bin = "#{node['loki']['zip']}"
|
loki_bin = "#{node['loki']['zip']}"
|
||||||
|
|
|
@ -38,7 +38,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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
|
vtag = $1
|
||||||
tag_version = vtag.sub('v', '')
|
tag_version = vtag.sub('v', '')
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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
|
vtag = $1
|
||||||
tag_version = vtag.sub('v', '')
|
tag_version = vtag.sub('v', '')
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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/, '')
|
tag = vtag.sub(/^v/, '')
|
||||||
|
|
||||||
alertmanager_bin = "#{node['alertmanager']['prefix']}#{tag}#{node['alertmanager']['postfix']}"
|
alertmanager_bin = "#{node['alertmanager']['prefix']}#{tag}#{node['alertmanager']['postfix']}"
|
||||||
|
|
|
@ -12,7 +12,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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']}"
|
alertmanager_webhook_bin = "#{node['alertmanager_webhook']['prefix']}#{tag}#{node['alertmanager_webhook']['postfix']}"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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/, '')
|
tag = vtag.sub(/^v/, '')
|
||||||
|
|
||||||
prometheus_bin = "#{node['prometheus']['prefix']}#{tag}#{node['prometheus']['postfix']}"
|
prometheus_bin = "#{node['prometheus']['prefix']}#{tag}#{node['prometheus']['postfix']}"
|
||||||
|
|
|
@ -13,7 +13,7 @@ begin
|
||||||
Timeout.timeout(3) do
|
Timeout.timeout(3) do
|
||||||
response = Net::HTTP.get_response(uri)
|
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/, '')
|
tag = vtag.sub(/^v/, '')
|
||||||
|
|
||||||
snmp_bin = "#{node['snmp_exporter']['prefix']}#{tag}#{node['snmp_exporter']['postfix']}"
|
snmp_bin = "#{node['snmp_exporter']['prefix']}#{tag}#{node['snmp_exporter']['postfix']}"
|
||||||
|
|
Loading…
Reference in New Issue