summaryrefslogtreecommitdiff
path: root/distixlib/ticket_store.py
diff options
context:
space:
mode:
Diffstat (limited to 'distixlib/ticket_store.py')
-rw-r--r--distixlib/ticket_store.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/distixlib/ticket_store.py b/distixlib/ticket_store.py
index a174b02..8f38084 100644
--- a/distixlib/ticket_store.py
+++ b/distixlib/ticket_store.py
@@ -69,6 +69,11 @@ class TicketStore(object):
ticket.make_clean()
self._dirty = False
+ def get_ticket_ids(self):
+ if os.path.exists(self._dirname):
+ return os.listdir(self._dirname)
+ return []
+
def get_ticket(self, ticket_id_or_prefix):
'''Return a distixlib.Ticket for an existing ticket in the store.'''
@@ -107,11 +112,10 @@ class TicketStore(object):
return self._load_tickets_from_ticket_cache(ticket_ids)
def _find_ticket_dirs(self):
- if os.path.exists(self._dirname):
- return [
- os.path.join(self._dirname, x)
- for x in os.listdir(self._dirname)]
- return []
+ return [
+ os.path.join(self._dirname, ticket_id)
+ for ticket_id in self.get_ticket_ids()
+ ]
def _cache_tickets(self, tickets):
for ticket in tickets: