From 1bb5486c28c15d4f8ff220ee1bb1b054e8ad2307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 25 May 2019 11:04:45 +0200 Subject: [PATCH] Create Zammad tags --- migrate.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/migrate.py b/migrate.py index 11d98cc..be8fd8e 100755 --- a/migrate.py +++ b/migrate.py @@ -47,6 +47,7 @@ if not source.login(): sys.exit(2) if os.path.exists('rt2zammad.cache'): + # Load RT from cache with open('rt2zammad.cache', 'rb') as handle: data = pickle.load(handle) users = data['users'] @@ -54,6 +55,7 @@ if os.path.exists('rt2zammad.cache'): tickets = data['tickets'] else: + # Load RT from remote users = {} tickets = [] queues = set() @@ -84,3 +86,11 @@ else: }) with open('rt2zammad.cache', 'wb') as handle: data = pickle.dump({'users': users, 'queues': queues, 'tickets': tickets}, handle) + +# Create tags +tag_list = TagList(target) +tags = {tag['name'] for tag in tag_list.all()} +for queue in queues: + queue = queue.lower().split()[0] + if queue not in tags: + tag_list.create({'name': queue})