Skip to content

Commit

Permalink
volumes: fix potentialy uninitilized warning, and link
Browse files Browse the repository at this point in the history
Signed-off-by: matthias.gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Sep 26, 2023
1 parent a585c09 commit cee8bd2
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions osc_tui/popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,9 @@ def editVolume(form, volume, form_color='STANDOUT'):
id = volume[0]
type = volume[1]
size = volume[2]
vm_id = volume[4]
#device_name = volume[5]
#iops = volume[6]
vm_id = volume[5]
#device_name = volume[6]
#iops = volume[7]

F = displayPopup(
name="{} ({}), {}gib, linked to: {}".format(id, type, size, vm_id))
Expand All @@ -557,17 +557,6 @@ def edit_cb():
mainForm.swicthToVolumeEdit(form, id, volume)
return

if vm_id == "Unlinked":
link = F.add_widget(
oscscreen.ButtonPress,
name="LINK",
)
else:
unlink = F.add_widget(
oscscreen.ButtonPress,
name="UNLINK",
)

def link_cb():
exit()
mainForm.MODE = "Volume-Link"
Expand All @@ -579,6 +568,19 @@ def unlink_cb():
exit()
return

if vm_id == "Unlinked":
link = F.add_widget(
oscscreen.ButtonPress,
name="LINK"
)
link.whenPressed = link_cb
else:
unlink = F.add_widget(
oscscreen.ButtonPress,
name="UNLINK",
)
unlink.whenPressed = unlink_cb

delete = F.add_widget(
oscscreen.ButtonPress,
name="DELETE",
Expand All @@ -592,10 +594,6 @@ def delete_cb():
form.current_grid.h_refresh(None)
exit()

if vm_id == "Unlinked":
link.whenPressed = link_cb
else:
unlink.whenPressed = unlink_cb
edit.whenPressed = edit_cb
delete.whenPressed = delete_cb

Expand Down

0 comments on commit cee8bd2

Please sign in to comment.