Ejemplo n.º 1
0
 def add_communication(self, name, communication_list, **kwargs):
     """
     Create a generic call for network communication.
     string name -- key of the call
     list of dict communication_list -- see
         pcs.test.tools.command_env.mock_node_communicator.create_communication
     **kwargs -- see
         pcs.test.tools.command_env.mock_node_communicator.create_communication
     """
     place_communication(self.__calls, name, communication_list, **kwargs)
Ejemplo n.º 2
0
    def check_pacemaker_started(
        self,
        pacemaker_started_node_list=(),
        pacemaker_not_started_node_list=(),
        communication_list=None,
        name="http.host.check_pacemaker_started",
    ):
        """
        Create a call for checking pacemaker status on nodes.

        pacemaker_started_node_list list -- list of node names on which
            pacemaker is fully running
        pacemaker_not_started_node_list list -- listof node names on which
            pacemaker is not fully started yet
        communication_list list -- create custom responses
        name string -- the key of this call
        """
        if (bool(pacemaker_started_node_list or
                 pacemaker_not_started_node_list) == bool(communication_list)):
            raise AssertionError(
                "Exactly one of 'pacemaker_started_node_list and/or "
                "pacemaker_not_started_node_list', 'communication_list' must "
                "be specified")
        if not communication_list:
            communication_list = [
                dict(label=node,
                     output=json.dumps(dict(
                         pending=False,
                         online=True,
                     ))) for node in pacemaker_started_node_list
            ] + [
                dict(label=node,
                     output=json.dumps(dict(
                         pending=True,
                         online=False,
                     ))) for node in pacemaker_not_started_node_list
            ]

        place_communication(
            self.__calls,
            name,
            communication_list,
            action="remote/pacemaker_node_status",
        )