diff --git a/lib/astute/mclient.rb b/lib/astute/mclient.rb index 66c8dff5..1fc5b7af 100644 --- a/lib/astute/mclient.rb +++ b/lib/astute/mclient.rb @@ -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 diff --git a/lib/astute/network.rb b/lib/astute/network.rb index e0bfb155..90a0031c 100644 --- a/lib/astute/network.rb +++ b/lib/astute/network.rb @@ -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 = {} diff --git a/lib/astute/orchestrator.rb b/lib/astute/orchestrator.rb index 7077e0a3..fe460803 100644 --- a/lib/astute/orchestrator.rb +++ b/lib/astute/orchestrator.rb @@ -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) diff --git a/lib/astute/server/dispatcher.rb b/lib/astute/server/dispatcher.rb index b7a3966b..cb7a5ea8 100644 --- a/lib/astute/server/dispatcher.rb +++ b/lib/astute/server/dispatcher.rb @@ -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) diff --git a/mcagents/net_probe.ddl b/mcagents/net_probe.ddl index c15bc453..da9128e0 100644 --- a/mcagents/net_probe.ddl +++ b/mcagents/net_probe.ddl @@ -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 diff --git a/mcagents/net_probe.rb b/mcagents/net_probe.rb index 41be8449..73625b3b 100644 --- a/mcagents/net_probe.rb +++ b/mcagents/net_probe.rb @@ -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