@@ -215,8 +215,6 @@ def apiFilePost(url, token, filePath, ignoreErrors=False):
215
215
return resp .text
216
216
217
217
def tackle2path (obj ):
218
- if 'assessment' in obj :
219
- return "/hub/pathfinder/%s" % obj .replace ("--" , "/" ) # Nested path decoding (e.g. assessments/assessment-risk)
220
218
return "/hub/%s" % obj
221
219
222
220
def loadDump (path , fallback_value = []):
@@ -244,7 +242,7 @@ def cmdWanted(args, action):
244
242
245
243
class TackleTool :
246
244
# TYPES order matters for import/upload to Tackle2
247
- TYPES = ['tagcategories' , 'tags' , 'jobfunctions' , 'stakeholdergroups' , 'stakeholders' , 'businessservices' , 'identities' , 'applications' , 'analyses' , ' proxies' , 'dependencies' , 'questionnaires' , 'archetypes' , 'assessments' , 'reviews' ]
245
+ TYPES = ['tagcategories' , 'tags' , 'jobfunctions' , 'stakeholdergroups' , 'stakeholders' , 'businessservices' , 'identities' , 'applications' , 'proxies' , 'dependencies' , 'questionnaires' , 'archetypes' , 'assessments' , 'reviews' ]
248
246
NOT_IMPORTED_TYPES = ['taskgroups' , 'tasks' ]
249
247
TACKLE2_SEED_TYPES = ['tagcategories' , 'tags' , 'jobfunctions' ]
250
248
@@ -303,16 +301,22 @@ class TackleTool:
303
301
304
302
# Gather Tackle 2 API objects
305
303
def dumpTackle2 (self ):
304
+ ensureDataDir (self .dataDir )
306
305
for t in self .TYPES :
307
306
print ("Exporting %s.." % t )
308
- if "identities" in t :
307
+ if t == "identities" :
309
308
dictCollection = apiJSON (self .tackle2Url + "/hub/identities?decrypted=1" , self .tackle2Token )
310
309
for dictObj in dictCollection :
311
310
dictObj ['key' ] = self .encrypt (dictObj ['key' ])
312
311
dictObj ['password' ] = self .encrypt (dictObj ['password' ])
313
312
dictObj ['settings' ] = self .encrypt (dictObj ['settings' ])
314
313
else :
315
314
dictCollection = apiJSON (self .tackle2Url + tackle2path (t ), self .tackle2Token )
315
+
316
+ # Remove legacy locked questionnaire from export to not cause conflict in import (should be 1st one)
317
+ if t == "questionnaires" :
318
+ dictCollection = dictCollection [1 :]
319
+
316
320
# Save data locally
317
321
saveJSON (os .path .join (self .dataDir , t ), dictCollection )
318
322
@@ -527,8 +531,6 @@ if cmdWanted(args, "export"):
527
531
# Setup data migration object
528
532
tool = TackleTool (args .data_dir , '' , '' , c ['url' ], token2 , c ['encryption_passphase' ])
529
533
530
- ensureDataDir (self .dataDir )
531
-
532
534
# Run the export expecting clean destination
533
535
print ("Exporting Tackle 2 objects into %s (this might take a while..)" % args .data_dir )
534
536
tool .dumpTackle2 ()
0 commit comments