Ejemplo n.º 1
0
def ensure_credential_server_running(foreground=False, run_once=False):
    """
   Instantiate our credential server and keep it running.
   """

    # is the watchdog running?
    pids = syndicate_watchdog.find_by_attrs(
        "syndicate-credential-server-watchdog", {})
    if len(pids) > 0:
        # it's running
        return True

    if foreground:
        # run in foreground

        if run_once:
            return credential_server_spawn(0)

        else:
            return syndicate_watchdog.main(credential_server_spawn,
                                           respawn_exit_statuses=range(1, 254))

    # not running, and not foregrounding.  fork a new one
    try:
        watchdog_pid = os.fork()
    except OSError, oe:
        logger.error("Failed to fork, errno = %s" % oe.errno)
        return False
Ejemplo n.º 2
0
def ensure_credential_server_running( foreground=False, run_once=False ):
   """
   Instantiate our credential server and keep it running.
   """
   
   # is the watchdog running?
   pids = syndicate_watchdog.find_by_attrs( "syndicate-credential-server-watchdog", {} )
   if len(pids) > 0:
      # it's running
      return True
   
   if foreground:
      # run in foreground 
      
      if run_once:
         return credential_server_spawn( 0 )
      
      else:
         return syndicate_watchdog.main( credential_server_spawn, respawn_exit_statuses=range(1,254) )
      
   
   # not running, and not foregrounding.  fork a new one
   try:
      watchdog_pid = os.fork()
   except OSError, oe:
      logger.error("Failed to fork, errno = %s" % oe.errno)
      return False
Ejemplo n.º 3
0
        logger.error("Failed to fork, errno = %s" % oe.errno)
        return False

    if watchdog_pid != 0:

        # child--become watchdog
        setproctitle.setproctitle("syndicate-credential-server-watchdog")

        if run_once:
            syndicate_daemon.daemonize(lambda: credential_server_spawn(0),
                                       logfile_path=getattr(
                                           CONFIG, "SYNDICATE_HTTP_LOGFILE",
                                           None))

        else:
            syndicate_daemon.daemonize(lambda: syndicate_watchdog.main(
                credential_server_spawn, respawn_exit_statuses=range(1, 254)),
                                       logfile_path=getattr(
                                           CONFIG, "SYNDICATE_HTTP_LOGFILE",
                                           None))


#-------------------------------
# Begin functional tests.
# Any method starting with ft_ is a functional test.
#-------------------------------


#-------------------------------
def ft_credential_server_1(syndicate_url, principal_id, principal_pkey_path):
    """
   Functional test for the credential server.
Ejemplo n.º 4
0
   try:
      watchdog_pid = os.fork()
   except OSError, oe:
      logger.error("Failed to fork, errno = %s" % oe.errno)
      return False
   
   if watchdog_pid != 0:
      
      # child--become watchdog
      setproctitle.setproctitle( "syndicate-credential-server-watchdog" )
      
      if run_once:
         syndicate_daemon.daemonize( lambda: credential_server_spawn(0), logfile_path=getattr(CONFIG, "SYNDICATE_HTTP_LOGFILE", None) )
      
      else:
         syndicate_daemon.daemonize( lambda: syndicate_watchdog.main( credential_server_spawn, respawn_exit_statuses=range(1,254) ), logfile_path=getattr(CONFIG, "SYNDICATE_HTTP_LOGFILE", None) )


#-------------------------------
# Begin functional tests.
# Any method starting with ft_ is a functional test.
#-------------------------------
  
#-------------------------------
def ft_syndicate_access():
    """
    Functional tests for ensuring objects exist and don't exist in Syndicate.
    """
    
    fake_user = FakeObject()
    fake_user.email = "*****@*****.**"