def _get_source_sum(source_hash, file_path, saltenv):
 ret = dict()
 schemes = (u'salt', u'http', u'https', u'ftp', u'swift', u's3', u'file')
 invalid_hash_msg = u"Source hash '{0}' format is invalid. It must be in the format <hash type>=<hash>".format(source_hash)
 source_hash = str(source_hash)
 source_hash_scheme = _urlparse(source_hash).scheme
 if (source_hash_scheme in schemes):
  cached_hash_file = __salt__[u'cp.cache_file'](source_hash, saltenv)
  if (not cached_hash_file):
   raise CommandExecutionError(u'Source hash file {0} not found'.format(source_hash))
  ret = __salt__[u'file.extract_hash'](cached_hash_file, u'', file_path)
  if (ret is None):
   raise SaltInvocationError(invalid_hash_msg)
 else:
  items = source_hash.split(u'=', 1)
  if (len(items) != 2):
   invalid_hash_msg = u'{0}, or it must be a supported protocol: {1}'.format(invalid_hash_msg, u', '.join(schemes))
   raise SaltInvocationError(invalid_hash_msg)
  (ret[u'hash_type'], ret[u'hsum']) = [item.strip().lower() for item in items]
 return ret

def _get_source_sum ( source_hash , file_path , saltenv ) : ret = dict ( ) schemes = ( u'salt' , u'http' , u'https' , u'ftp' , u'swift' , u's3' , u'file' ) invalid_hash_msg = u"Source hash '{0}' format is invalid. It must be in the format <hash type>=<hash>" . format ( source_hash ) source_hash = str ( source_hash ) source_hash_scheme = _urlparse ( source_hash ) . scheme if ( source_hash_scheme in schemes ) : cached_hash_file = __salt__ [ u'cp.cache_file' ] ( source_hash , saltenv ) if ( not cached_hash_file ) : raise CommandExecutionError ( u'Source hash file {0} not found' . format ( source_hash ) ) ret = __salt__ [ u'file.extract_hash' ] ( cached_hash_file , u'' , file_path ) if ( ret is None ) : raise SaltInvocationError ( invalid_hash_msg ) else : items = source_hash . split ( u'=' , 1 ) if ( len ( items ) != 2 ) : invalid_hash_msg = u'{0}, or it must be a supported protocol: {1}' . format ( invalid_hash_msg , u', ' . join ( schemes ) ) raise SaltInvocationError ( invalid_hash_msg ) ( ret [ u'hash_type' ] , ret [ u'hsum' ] ) = [ item . strip ( ) . lower ( ) for item in items ] return ret
extract the hash sum .