Skip to content

Commit

Permalink
Fixes to progress bar display.
Browse files Browse the repository at this point in the history
Additionally fixing the setting of an old cloud to validated false
even after assignment to new cloud is not succesfully completed.

Change-Id: Ic9ca2e02b09eeaf55ee7ffd47ddc9693d0b22ae1
  • Loading branch information
grafuls committed Aug 5, 2019
1 parent 2977dbe commit ad4d5cc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
13 changes: 8 additions & 5 deletions bin/quads-cli
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -373,13 +373,16 @@ def main(_args):
except Exception: except Exception:
logger.exception('Move command failed for host: %s' % host) logger.exception('Move command failed for host: %s' % host)
provisioned = False provisioned = False

# TODO: Add logic here for setting host to validated=false
if not _args.dryrun and provisioned: # if result["new"]==default_cloud
_new_cloud_obj = Cloud.objects(name=_cloud).first()
_new_cloud_obj.update(provisioned=True) if not _args.dryrun:
if provisioned:
_new_cloud_obj = Cloud.objects(name=_cloud).first()
_new_cloud_obj.update(provisioned=True)
make_instackenv_json.main()
_old_cloud_obj = Cloud.objects(name=results[0]["current"]).first() _old_cloud_obj = Cloud.objects(name=results[0]["current"]).first()
_old_cloud_obj.update(provisioned=False, validated=False, vlan=None, wipe=True) _old_cloud_obj.update(provisioned=False, validated=False, vlan=None, wipe=True)
make_instackenv_json.main()


exit(0) exit(0)


Expand Down
27 changes: 19 additions & 8 deletions quads/tools/create_input_assignments.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ def print_header():


def print_summary(): def print_summary():
_summary = [] _summary = []
_headers = ["**NAME**", "**SUMMARY**", "**OWNER**", "**REQUEST**", "**STATUS**"] _headers = [
'**NAME**',
'**SUMMARY**',
'**OWNER**',
'**REQUEST**',
'     **STATUS**    '
]
if conf["openstack_management"]: if conf["openstack_management"]:
_headers.append("**INSTACKENV**") _headers.append("**INSTACKENV**")
if conf["gather_ansible_facts"]: if conf["gather_ansible_facts"]:
Expand Down Expand Up @@ -60,9 +66,8 @@ def print_summary():
style_tag_start = '<span style="color:green">' style_tag_start = '<span style="color:green">'
instack_link = os.path.join(conf["quads_url"], "cloud", "%s_instackenv.json" % cloud_name) instack_link = os.path.join(conf["quads_url"], "cloud", "%s_instackenv.json" % cloud_name)
instack_text = "download" instack_text = "download"
status = '<span class="progress" style="margin-bottom:0px">\ status = '<span class="progress" style="margin-bottom:0px"><span role="progressbar" aria-valuenow="100" ' \
<span role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%" \ 'aria-valuemin="0" aria-valuemax="100" style="width:100%" class="progress-bar">100%</span></span> '
class="progress-bar">100%</span></span>'
else: else:
cloud_obj = Cloud.objects(name=cloud_name).first() cloud_obj = Cloud.objects(name=cloud_name).first()
scheduled_hosts = Schedule.current_schedule(cloud=cloud_obj).count() scheduled_hosts = Schedule.current_schedule(cloud=cloud_obj).count()
Expand All @@ -71,10 +76,16 @@ def print_summary():
style_tag_start = '<span style="color:red">' style_tag_start = '<span style="color:red">'
instack_link = "#" instack_link = "#"
instack_text = "validating" instack_text = "validating"
classes = ["progress-bar", "progress-bar-striped", "progress-bar-warning", "active"] if percent < 15:
status = '<span class="progress" style="margin-bottom:0px">\ classes = ["progress-bar", "progress-bar-striped", "progress-bar-danger", "active"]
<span role="progressbar" aria-valuenow="%.0f" aria-valuemin="0" aria-valuemax="100" style="width:%.0f%%" \ status = '<span class="progress" style="margin-bottom:0px"><span role="progressbar" ' \
class="%s">%.0f%%</span></span>' % (percent, percent, " ".join(classes), percent) 'aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%%" ' \
'class="%s">%.0f%%</span></span>' % (" ".join(classes), percent)
else:
classes = ["progress-bar", "progress-bar-striped", "progress-bar-warning", "active"]
status = '<span class="progress" style="margin-bottom:0px"><span role="progressbar" ' \
'aria-valuenow="%.0f" aria-valuemin="0" aria-valuemax="100" style="width:%.0f%%" ' \
'class="%s">%.0f%%</span></span>' % (percent, percent, " ".join(classes), percent)


_data = ["[%s%s%s](#%s)" % (style_tag_start, cloud_name, style_tag_end, cloud_name), desc, owner, link] _data = ["[%s%s%s](#%s)" % (style_tag_start, cloud_name, style_tag_end, cloud_name), desc, owner, link]


Expand Down

0 comments on commit ad4d5cc

Please sign in to comment.