def inject_data(image, key=None, net=None, metadata=None, admin_password=None, files=None, partition=None, use_cow=False, mandatory=()):
 LOG.debug((_('Inject data image=%(image)s key=%(key)s net=%(net)s metadata=%(metadata)s admin_password=ha-ha-not-telling-you files=%(files)s partition=%(partition)s use_cow=%(use_cow)s') % locals()))
 fmt = 'raw'
 if use_cow:
  fmt = 'qcow2'
 try:
  fs = vfs.VFS.instance_for_image(image, fmt, partition)
  fs.setup()
 except Exception as e:
  for inject in mandatory:
   inject_val = locals()[inject]
   if inject_val:
    raise
  LOG.warn((_('Ignoring error injecting data into image (%(e)s)') % locals()))
  return False
 try:
  return inject_data_into_fs(fs, key, net, metadata, admin_password, files, mandatory)
 finally:
  fs.teardown()

def inject_data ( image , key = None , net = None , metadata = None , admin_password = None , files = None , partition = None , use_cow = False , mandatory = ( ) ) : LOG . debug ( ( _ ( 'Inject data image=%(image)s key=%(key)s net=%(net)s metadata=%(metadata)s admin_password=ha-ha-not-telling-you files=%(files)s partition=%(partition)s use_cow=%(use_cow)s' ) % locals ( ) ) ) fmt = 'raw' if use_cow : fmt = 'qcow2' try : fs = vfs . VFS . instance_for_image ( image , fmt , partition ) fs . setup ( ) except Exception as e : for inject in mandatory : inject_val = locals ( ) [ inject ] if inject_val : raise LOG . warn ( ( _ ( 'Ignoring error injecting data into image (%(e)s)' ) % locals ( ) ) ) return False try : return inject_data_into_fs ( fs , key , net , metadata , admin_password , files , mandatory ) finally : fs . teardown ( )
inject the specified items into a disk image .