Skip to content

Commit

Permalink
fix scaling in
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 6, 2019
1 parent 56c95c0 commit d626ec6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions pk1/engines/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,20 @@ def scale_in_cluster(sender,instance,**kwargs):
if not cluster.steps.all().exists():
destroyed.send(sender=models.Cluster, instance=cluster, name='destroyed')
cluster.delete()
else:
elif instance.hosts:
cluster.update_remedy_script(
utils.remedy_script_hosts_remove(instance.hosts),
heading=True
)
if cluster.scale.remedy_script_scale_in:
cluster.update_remedy_script(
cluster.scale.remedy_script_scale_in,
heading=True
)
scale_in_script=''
for h in instance.hosts.split('\n'):
if h.startswith('#'): continue
scale_in_script+=cluster.scale.remedy_script_scale_in.format(hostname=h.split(' ')[-1])+'\n'
cluster.update_remedy_script(
scale_in_script,
heading=True
)
cluster.remedy()

@receiver(monitored, sender=Group)
@receiver(tidied, sender=models.ClusterOperation)
Expand Down
2 changes: 1 addition & 1 deletion pk1/engines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def remedy_scale_ambari_fast_scale_out():
'ambari master1:8080 service start'

def remedy_scale_ambari_fast_scale_in():
return '#ambari master1:8080 host delete `hostname`'
return 'if [ `hostname` == "master1.packone" ]; then\nambari master1:8080 host delete {hostname}\nfi'

0 comments on commit d626ec6

Please sign in to comment.