def _qemu_image_info(path):
 ret = {}
 out = __salt__['cmd.run']('qemu-img info {0}'.format(path))
 match_map = {'size': 'virtual size: \\w+ \\((\\d+) byte[s]?\\)', 'format': 'file format: (\\w+)'}
 for (info, search) in six.iteritems(match_map):
  try:
   ret[info] = re.search(search, out).group(1)
  except AttributeError:
   continue
 return ret

def _qemu_image_info ( path ) : ret = { } out = __salt__ [ 'cmd.run' ] ( 'qemu-img info {0}' . format ( path ) ) match_map = { 'size' : 'virtual size: \\w+ \\((\\d+) byte[s]?\\)' , 'format' : 'file format: (\\w+)' } for ( info , search ) in six . iteritems ( match_map ) : try : ret [ info ] = re . search ( search , out ) . group ( 1 ) except AttributeError : continue return ret
detect information for the image at path .