From 00070019328642a0a6caa4fae3389d213845c2ab Mon Sep 17 00:00:00 2001 From: "matthias.gatto" Date: Thu, 23 Nov 2023 17:07:33 +0100 Subject: [PATCH] with the file, public ips work better... Signed-off-by: matthias.gatto --- osc_tui/publicIps.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 osc_tui/publicIps.py diff --git a/osc_tui/publicIps.py b/osc_tui/publicIps.py new file mode 100644 index 0000000..30df491 --- /dev/null +++ b/osc_tui/publicIps.py @@ -0,0 +1,20 @@ +from osc_tui import main +from osc_tui import popup +from osc_tui import selectableGrid + +class publicIpsGrid(selectableGrid.SelectableGrid): + def __init__(self, screen, *args, **keywords): + super().__init__(screen, *args, **keywords) + self.col_titles = ["Id", "Public Ip", "Vm Id"] + + def refresh_call(self, name_filter=None): + groups = main.GATEWAY.ReadPublicIps(form=self.form)['PublicIps'] + return groups + + def refresh(self): + groups = main.do_search(self.data.copy(), ["PublicIpId", "PublicIp", "VmId"]) + values = list() + for g in groups: + VmId = g["VmId"] if "VmId" in g else "unattached" + values.append([g['PublicIpId'], g["PublicIp"], VmId]) + self.values = values