def __init__(self, parent): """Initialize the class. Args: config_dir: Configuration directory Returns: None """ # Initialize key variables Agent.__init__(self, parent)
def __init__(self, parent, config=None): """Initialize the class. Args: parent: Name of agent parent process config: Config object Returns: None """ # Initialize key variables Agent.__init__(self, parent, config=config)
def __init__(self, parent): """Initialize the class. Args: parent: Name of parent program Returns: None """ # Initialize key variables Agent.__init__(self, parent) self._agent_name = parent
def __init__(self, parent): """Initialize the class. Args: config_dir: Configuration directory Returns: None """ # Initialize key variables Agent.__init__(self, parent) # Initialize key variables self._agent_name = PATTOO_AGENT_MODBUSTCPD
def main(): """Start the Gunicorn WSGI. Args: None Returns: None """ # Initialize key variables config = Config() # Make sure we have a database _ = connectivity() # Create agent object for web_proxy agent_gunicorn = Agent(PATTOO_API_WEB_PROXY, config=config) # Create agent for daemon agent_api = AgentAPI( PATTOO_API_WEB_NAME, PATTOO_API_WEB_PROXY, PATTOO_API_WEB, config=config) # Do control (API first, Gunicorn second) cli = AgentCLI() cli.control(agent_api) cli.control(agent_gunicorn)
def main(): """Main function to start the Gunicorn WSGI.""" # Initialize key variables config = Config() # Make sure we have a database _ = connectivity() # Create agent object for web_proxy agent_gunicorn = Agent(PATTOO_API_AGENT_PROXY, config=config) # Create agent for daemon config = Config() agent_api = AgentAPI( PATTOO_API_AGENT_NAME, PATTOO_API_AGENT_PROXY, PATTOO_API_AGENT, config=config) # Add set API email address agent_api.set_api_email() # Set up encryption using Pgpier in Agent agent_api.set_gnupg() # Creation and retrieval of Pgpier object # Do control (API first, Gunicorn second) cli = AgentCLI() cli.control(agent_api) cli.control(agent_gunicorn)
def create_agent(): """Creates new agent for use in testing start and restart Args: None Return: _agent: new agent for testing """ _agent = Agent(parent=AGENT_NAME, config=_config) return _agent
def _create_agent(): """Creates new test agent. Args: None Return: result: new agent for testing """ # Return config = Config() name = general.random_agent_name() result = Agent(name, config=config) return result
def main(): """Control the Gunicorn WSGI.""" # Create Gunicorn object to daemonize agent_api = Agent(PATTOO_AGENT_OS_SPOKED_PROXY) # Create Flask object to daemonize config = configuration.ConfigSpoked() agent_gunicorn = AgentAPI(PATTOO_AGENT_OS_SPOKED, PATTOO_AGENT_OS_SPOKED_PROXY, API, config=config) # Do control (Gunicorn first, Daemonized query second) cli = AgentCLI() cli.control(agent_gunicorn) cli.control(agent_api)
def main(): """Start the Gunicorn WSGI.""" # Initialize key variables config = Config() # Get PID filenename for Gunicorn agent_gunicorn = Agent(PATTOO_WEBD_PROXY, config=config) # Get configuration agent_api = AgentAPI(PATTOO_WEBD_NAME, PATTOO_WEBD_PROXY, PATTOO_WEBD, config=config) # Do control (API first, Gunicorn second) cli = AgentCLI() cli.control(agent_api) cli.control(agent_gunicorn)
def main(): """Main function to start the Gunicorn WSGI.""" # Initialize key variables config = Config() # Make sure we have a database _ = connectivity() # Create agent object for web_proxy agent_gunicorn = Agent(PATTOO_API_AGENT_PROXY, config=config) # Create agent for daemon config = Config() agent_api = AgentAPI(PATTOO_API_AGENT_NAME, PATTOO_API_AGENT_PROXY, PATTOO_API_AGENT, config=config) # Do control (API first, Gunicorn second) cli = AgentCLI() cli.control(agent_api) cli.control(agent_gunicorn)
def main(): """Test all the pattoo-shared modules with unittests. Args: None Returns: None """ # Initialize key variables config = Config() # Set up parser parser = argparse.ArgumentParser() parser.add_argument('--start', help='Start daemon', action='store_true') parser.add_argument('--stop', help='Start daemon', action='store_true') parser.add_argument('--restart', help='Start daemon', action='store_true') parser.add_argument('--status', help='Daemon status', action='store_true') parser.add_argument('--agent_name', help='Agent name', type=str, required=True) args = parser.parse_args() # Daemon manipulation agent_ = Agent(args.agent_name, config=config) daemon = MockDaemon(agent_) if bool(args.start): daemon.start() elif bool(args.stop): daemon.stop() elif bool(args.restart): daemon.restart() elif bool(args.status): daemon.status() else: print('No command matches')