code: def dropfile(cachedir, user=None):
      '''
      Set an AES dropfile to request the master update the publish session key
      '''
      dfn = os.path.join(cachedir, '.dfn')
      # set a mask (to avoid a race condition on file creation) and store original.
      with salt.utils.files.set_umask(0o277):
          log.info('Rotating AES key')
          if os.path.isfile(dfn):
              log.info('AES key rotation already requested')
              return
  
          if os.path.isfile(dfn) and not os.access(dfn, os.W_OK):
              os.chmod(dfn, stat.S_IRUSR | stat.S_IWUSR)
          with salt.utils.files.fopen(dfn, 'wb+') as fp_:
              fp_.write(b'')
          os.chmod(dfn, stat.S_IRUSR)
          if user:
              try:
                  import pwd
                  uid = pwd.getpwnam(user).pw_uid
                  os.chown(dfn, uid, -1)
              except (KeyError, ImportError, OSError, IOError):
                  pasf dropfile(cachedir, user=None):
      '''
      Set an AES dropfile to request the master update the publish session key
      '''
      dfn = os.path.join(cachedir, '.dfn')
      # set a mask (to avoid a race condition on file creation) and store original.
      with salt.utils.files.set_umask(0o277):
          log.info('Rotating AES key')
          if os.path.isfile(dfn):
              log.info('AES key rotation already requested')
              return
  
          if os.path.isfile(dfn) and not os.access(dfn, os.W_OK):
              os.chmod(dfn, stat.S_IRUSR | stat.S_IWUSR)
          with salt.utils.files.fopen(dfn, 'wb+') as fp_:
              fp_.write(b'')
          os.chmod(dfn, stat.S_IRUSR)
          if user:
              try:
                  import pwd
                  uid = pwd.getpwnam(user).pw_uid
                  os.chown(dfn, uid, -1)
              except (KeyError, ImportError, OSError, IOError):
                  pass
docs: Set an AES dropfile to request the master update the publish session key