def _new_serial(ca_name):
 hashnum = int(binascii.hexlify('{0}_{1}'.format(_microtime(), os.urandom(5))), 16)
 log.debug('Hashnum: {0}'.format(hashnum))
 cachedir = __opts__['cachedir']
 log.debug('cachedir: {0}'.format(cachedir))
 serial_file = '{0}/{1}.serial'.format(cachedir, ca_name)
 if (not os.path.exists(cachedir)):
  os.makedirs(cachedir)
 if (not os.path.exists(serial_file)):
  fd = salt.utils.fopen(serial_file, 'w')
 else:
  fd = salt.utils.fopen(serial_file, 'a+')
 with fd as ofile:
  ofile.write(str(hashnum))
 return hashnum

def _new_serial ( ca_name ) : hashnum = int ( binascii . hexlify ( '{0}_{1}' . format ( _microtime ( ) , os . urandom ( 5 ) ) ) , 16 ) log . debug ( 'Hashnum: {0}' . format ( hashnum ) ) cachedir = __opts__ [ 'cachedir' ] log . debug ( 'cachedir: {0}' . format ( cachedir ) ) serial_file = '{0}/{1}.serial' . format ( cachedir , ca_name ) if ( not os . path . exists ( cachedir ) ) : os . makedirs ( cachedir ) if ( not os . path . exists ( serial_file ) ) : fd = salt . utils . fopen ( serial_file , 'w' ) else : fd = salt . utils . fopen ( serial_file , 'a+' ) with fd as ofile : ofile . write ( str ( hashnum ) ) return hashnum
return a serial number in hex using os .