Skip to content

Commit

Permalink
Merge pull request #835 from shtripat/expand-cluster-with-detected-pe…
Browse files Browse the repository at this point in the history
…ers-1

Added event log for newly added nodes to the cluster
  • Loading branch information
r0h4n authored Feb 27, 2018
2 parents 089a6b3 + 83104c3 commit ae1875e
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def run(self):
"import" % integration_id)

job_ids = []
new_peers = []
for node_id in node_ids:
_cnc = NS.tendrl.objects.ClusterNodeContext(
node_id=node_id
Expand Down Expand Up @@ -99,10 +100,11 @@ def run(self):
job_id=self.parameters['job_id']
)
job_ids.append(_job_id)
new_peers.append(node_id)

loop_count = 0
# Wait for (no of nodes) * 6 minutes for import to complete
wait_count = len(node_ids) * 36
wait_count = len(job_ids) * 36
while True:
if loop_count >= wait_count:
logger.log(
Expand Down Expand Up @@ -141,4 +143,16 @@ def run(self):
'job_id': self.job_id
}
_cluster.save()

logger.log(
"info",
NS.publisher_id,
{
"message": "Newly detected node(s) added to the cluster."
"(nodes: %s) (integration_id: %s)" % (
str(new_peers),
integration_id
)
}
)
return True

0 comments on commit ae1875e

Please sign in to comment.