Browse Source

Merge "All offline nodes are removed as failed nodes"

changes/65/234665/5
Jenkins 7 years ago committed by Gerrit Code Review
parent
commit
cfd5d6b916
  1. 10
      lib/astute/deployment_engine.rb
  2. 24
      spec/unit/deployment_engine_spec.rb

10
lib/astute/deployment_engine.rb

@ -149,7 +149,7 @@ module Astute
# Removes nodes which failed to provision
def remove_failed_nodes(deployment_info, pre_deployment, post_deployment)
uids = deployment_info.map { |node| node["uid"]}
uids = get_uids_from_deployment_info deployment_info
required_nodes = deployment_info.select { |node| node["fail_if_error"] }
required_uids = required_nodes.map { |node| node["uid"]}
@ -257,5 +257,13 @@ module Astute
available_uids
end
def get_uids_from_deployment_info(deployment_info)
top_level_uids = deployment_info.map{ |node| node["uid"] }
inside_uids = deployment_info.inject([]) do |uids, node|
uids += node.fetch('nodes', []).map{ |n| n['uid'] }
end
top_level_uids | inside_uids
end
end
end

24
spec/unit/deployment_engine_spec.rb

@ -416,14 +416,12 @@ describe Astute::DeploymentEngine do
'nodes' => [
{'uid' => '1', 'role' => 'compute'},
{'uid' => '2', 'role' => 'primary-controller'},
{'uid' => '4', 'role' => 'compute'}
]
},
{'uid' => "2", 'priority' => 10, 'role' => 'primary-controller',
'nodes' => [
{'uid' => '1', 'role' => 'compute'},
{'uid' => '2', 'role' => 'primary-controller'},
{'uid' => '4', 'role' => 'compute'}
]
}
]
@ -443,6 +441,12 @@ describe Astute::DeploymentEngine do
'error_type' => 'provision',
'role' => 'hook',
'error_msg' => 'Node is not ready for deployment: mcollective has not answered'
},{
'uid' => '4',
'status' => 'error',
'error_type' => 'provision',
'role' => 'hook',
'error_msg' => 'Node is not ready for deployment: mcollective has not answered'
}],
'error' => 'Node is not ready for deployment'
)
@ -488,14 +492,12 @@ describe Astute::DeploymentEngine do
'nodes' => [
{'uid' => '1', 'role' => 'compute'},
{'uid' => '2', 'role' => 'primary-controller'},
{'uid' => '4', 'role' => 'compute'}
]
},
{'uid' => "2", 'priority' => 10, 'role' => 'primary-controller',
'nodes' => [
{'uid' => '1', 'role' => 'compute'},
{'uid' => '2', 'role' => 'primary-controller'},
{'uid' => '4', 'role' => 'compute'}
]
}
]
@ -515,6 +517,12 @@ describe Astute::DeploymentEngine do
'error_type' => 'provision',
'role' => 'hook',
'error_msg' => 'Node is not ready for deployment: mcollective has not answered'
}, {
'uid' => '4',
'status' => 'error',
'error_type' => 'provision',
'role' => 'hook',
'error_msg' => 'Node is not ready for deployment: mcollective has not answered'
}],
'error' => 'Node is not ready for deployment'
)
@ -546,7 +554,7 @@ describe Astute::DeploymentEngine do
{'uid' => '1', 'role' => 'compute'},
{'uid' => '2', 'role' => 'primary-controller'},
{'uid' => '4', 'role' => 'compute'}
]}
]}
]
res1 = {:data => {:node_type => "target\n"},
@ -565,6 +573,12 @@ describe Astute::DeploymentEngine do
'error_type' => 'provision',
'role' => 'hook',
'error_msg' => 'Node is not ready for deployment: mcollective has not answered'
},{
'uid' => '4',
'status' => 'error',
'error_type' => 'provision',
'role' => 'hook',
'error_msg' => 'Node is not ready for deployment: mcollective has not answered'
}],
'error' => 'Node is not ready for deployment'
)

Loading…
Cancel
Save