old_contents: '''
  Manage the registry on Windows
  '''
  
  
  def __virtual__():
      '''
      Load this state if the reg module exists
      '''
      
      return 'reg' if 'reg.read_key' in __salt__ else False
  
  
  def _parse_key(key):
      '''
      split the full path in the registry to the key and the rest
      '''
      
      splt = key.split('\\')
      hive = splt.pop(0)
      key = splt.pop(-1)
      path = '\\'.join(splt)
      return hive, path, key
  
  
  def value_exists(name, value):
      '''
      Set a registry entry
      
      Example::
  
          'HKEY_CURRENT_USER\SOFTWARE\Salt\version':
            reg.value_exists:
              - value: 0.15.3
      '''
      
      ret = {'name': name,
             'result': True,
             'changes': {},
             'comment': ''}
      
      # determine what to do
      hive, path, key = _parse_key(name)
      if value == __salt__['reg.read_key'](hive, path, key):
          ret['comment'] = '{0} is already configured'.format( name )
          return ret
      else:
          ret['changes'] = {'reg': 'configured to {}'.format(value) }
      
      if __opts__['test']:
          return ret
      
      # configure the key
      ret['result'] = __salt__['reg.set_key'](hive, path, key, str(value))
      if not ret:
          ret['changes'] = {}
          ret['comment'] = 'could not configure the registry key'
      
      return ret
  
  
  
new_contents: '''
  Manage the registry on Windows
  '''
  
  
  def __virtual__():
      '''
      Load this state if the reg module exists
      '''
      
      return 'reg' if 'reg.read_key' in __salt__ else False
  
  
  def _parse_key(key):
      '''
      split the full path in the registry to the key and the rest
      '''
      
      splt = key.split('\\')
      hive = splt.pop(0)
      key = splt.pop(-1)
      path = '\\'.join(splt)
      return hive, path, key
  
  
  def value_exists(name, value):
      '''
      Set a registry entry
      
      Example::
  
          'HKEY_CURRENT_USER\SOFTWARE\Salt\version':
            reg.value_exists:
              - value: 0.15.3
      '''
      
      ret = {'name': name,
             'result': True,
             'changes': {},
             'comment': ''}
      
      # determine what to do
      hive, path, key = _parse_key(name)
      if value == __salt__['reg.read_key'](hive, path, key):
          ret['comment'] = '{0} is already configured'.format( name )
          return ret
      else:
          ret['changes'] = {'reg': 'configured to {}'.format(value) }
      
      if __opts__['test']:
          return ret
      
      # configure the key
      ret['result'] = __salt__['reg.set_key'](hive, path, key, int(value))
      if not ret:
          ret['changes'] = {}
          ret['comment'] = 'could not configure the registry key'
      
      return ret
  
  
  
subject: fix casting to int