Skip to content

Commit 545bbf8

Browse files
author
vshepard
committed
show_archive add print tli
1 parent 5c7cf18 commit 545bbf8

File tree

1 file changed

+21
-12
lines changed
  • testgres/plugins/pg_probackup2/pg_probackup2

1 file changed

+21
-12
lines changed

testgres/plugins/pg_probackup2/pg_probackup2/app.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -554,35 +554,44 @@ def show_archive(
554554
# You should print it when calling as_text=true
555555
return self.run(cmd_list + options, old_binary=old_binary, expect_error=expect_error)
556556

557+
result = {}
558+
instance_timelines = None
559+
557560
if as_json:
558561
if as_text:
559562
data = self.run(cmd_list + options, old_binary=old_binary, expect_error=expect_error)
560563
else:
561564
data = json.loads(self.run(cmd_list + options, old_binary=old_binary, expect_error=expect_error))
562565

563566
if instance:
564-
instance_timelines = None
565567
for instance_name in data:
566568
if instance_name['instance'] == instance:
567569
instance_timelines = instance_name['timelines']
568570
break
569571

570572
if tli > 0:
573+
timeline_found = False
571574
for timeline in instance_timelines:
572575
if timeline['tli'] == tli:
573-
return timeline
574-
575-
return {}
576-
577-
if instance_timelines:
578-
return instance_timelines
579-
580-
return data
576+
result = timeline
577+
timeline_found = True
578+
break
579+
if not timeline_found:
580+
result = {}
581+
582+
elif instance_timelines:
583+
result = instance_timelines
584+
else:
585+
result = data
586+
else:
587+
result = data
581588
else:
582-
show_splitted = self.run(cmd_list + options, old_binary=old_binary,
583-
expect_error=expect_error).splitlines()
584-
logging.error(show_splitted)
589+
show_splitted = self.run(cmd_list + options, old_binary=old_binary, expect_error=expect_error).splitlines()
590+
print(show_splitted)
585591
exit(1)
592+
if result == {}:
593+
print(f"tli={tli} was not found. {instance_timelines}")
594+
return result
586595

587596
def validate(
588597
self, instance=None, backup_id=None,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy