Use urlaccesscheck to try to retrieve repos

Add check_url_retrieval action to net_probe.rb. It uses urlaccesscheck
from network checker to retrieve urls passed as parameter.

Add check_repositories method to dispatcher. It uses above action via
orchestrator to test given urls.

Partial-Bug: #1439686
Depends-On: Idc04f74ad7364dee452e9151391654f828e2342d
Change-Id: Ifb28bd0a53abf07e48d41683d10f90546889b0e4
This commit is contained in:
Maciej Kwiek 2015-05-13 18:12:38 +02:00
parent 07c0170936
commit 12ef23583a
6 changed files with 33 additions and 0 deletions

View File

@ -146,6 +146,7 @@ module Astute
retries = 1
begin
@mc = rpcclient(@agent, :exit_on_failure => false)
@mc.timeout = @timeout if @timeout
@mc.progress = false
if @nodes

View File

@ -114,6 +114,15 @@ module Astute
{'nodes' => response}
end
def self.check_urls_access(ctx, nodes, urls)
uids = nodes.map { |node| node['uid'].to_s }
net_probe = MClient.new(ctx, "net_probe", uids)
result = net_probe.check_url_retrieval(:urls => urls)
{'nodes' => result, 'status'=> 'ready'}
end
private
def self.start_frame_listeners(ctx, net_probe, nodes)
data_to_send = {}

View File

@ -147,6 +147,12 @@ module Astute
Network.multicast_verification(ctx, nodes)
end
def check_repositories(reporter, task_id, nodes, urls)
ctx = Context.new(task_id, reporter)
validate_nodes_access(ctx, nodes)
Network.check_urls_access(ctx, nodes, urls)
end
private
def deploy_cluster(up_reporter, task_id, deployment_info, deploy_engine, pre_deployment, post_deployment)

View File

@ -148,6 +148,12 @@ module Astute
report_result(result, reporter)
end
def check_repositories(data)
reporter = Astute::Server::Reporter.new(@producer, data['respond_to'], data['args']['task_uuid'])
result = @orchestrator.check_repositories(reporter, data['args']['task_uuid'], data['args']['nodes'], data['args']['urls'])
report_result(result, reporter)
end
def dump_environment(data)
task_id = data['args']['task_uuid']
reporter = Astute::Server::Reporter.new(@producer, data['respond_to'], task_id)

View File

@ -41,3 +41,7 @@ end
action "multicast_info", :description => "Request received data from multicast frames" do
display :always
end
action "check_url_retrieval", :description => "Check if urls are retrievable" do
display :always
end

View File

@ -67,6 +67,13 @@ module MCollective
reply[:status] = run(cmd, :stdout => :out, :stderr => :err)
end
action "check_url_retrieval" do
urls = request.data[:urls] || []
cmd = "urlaccesscheck check '#{urls.join("' '")}'"
reply[:status] = run(cmd, :stdout => :out, :stderr => :err)
end
private
def get_uid