2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Provide keyname to importer

This allows client to reliably make association
between import request and tracking
the import activity.
This commit is contained in:
Jarrod Johnson 2020-05-12 14:47:00 -04:00
parent 8a48909ae3
commit 1ba2386b82
3 changed files with 4 additions and 2 deletions

View File

@ -21,7 +21,7 @@ def osimport(imagefile):
for rsp in c.create('/deployment/importing/', {'filename': imagefile}):
if 'target' in rsp:
importing = True
shortname = rsp['target'].split('/')[-1]
shortname = rsp['name']
print('Importing from {0} to {1}'.format(imagefile, rsp['target']))
else:
print(repr(rsp))

View File

@ -166,7 +166,8 @@ def handle_deployment(configmanager, inputdata, pathcomponents,
return
elif operation == 'create':
importer = osimage.MediaImporter(inputdata['filename'])
yield msg.KeyValueData({'target': importer.targpath})
yield msg.KeyValueData({'target': importer.targpath,
'name': importer.importkey})
return
elif len(pathcomponents) == 3:
if operation == 'retrieve':

View File

@ -339,6 +339,7 @@ class MediaImporter(object):
raise Exception('Media import already in progress for this media')
self.importkey = importkey
importing[importkey] = self
self.importkey = importkey
self.osname = identity['name']
self.oscategory = identity.get('category', None)
targpath = identity['name']