Example #1
0
    def push(
        self,
        modifiers=None,
        name="runner.cib.push",
        load_key="runner.cib.load",
        instead=None,
        stderr="",
        returncode=0,
        **modifier_shortcuts
    ):
        """
        Create call for pushing cib.
        Cib is taken from the load call by default.

        string name -- key of the call
        list of callable modifiers -- every callable takes etree.Element and
            returns new etree.Element with desired modification.
        string load_key -- key of a call from which stdout can be cib taken
        string instead -- key of call instead of which this new call is to be
            placed
        dict modifier_shortcuts -- a new modifier is generated from each
            modifier shortcut.
            As key there can be keys of MODIFIER_GENERATORS.
            Value is passed into appropriate generator from MODIFIER_GENERATORS.
            For details see pcs_test.tools.fixture_cib (mainly the variable
            MODIFIER_GENERATORS - please refer it when you are adding params
            here)
        """
        cib = modify_cib(
            self.__calls.get(load_key).stdout,
            modifiers,
            **modifier_shortcuts
        )
        self.__calls.place(
            name,
            RunnerCall(
                "cibadmin --replace --verbose --xml-pipe --scope configuration",
                stderr=stderr,
                returncode=returncode,
                check_stdin=create_check_stdin_xml(cib),
            ),
            instead=instead,
        )
Example #2
0
 def push_diff(self,
               name="runner.cib.push_diff",
               cib_diff="resulting diff",
               stdout="",
               stderr="",
               returncode=0):
     """
     Create a call for pushing a diff of CIBs
     string name -- key of the call
     string cib_diff -- the diff of CIBs
     """
     self.__calls.place(
         name,
         RunnerCall(
             "cibadmin --patch --verbose --xml-pipe",
             check_stdin=create_check_stdin_xml(cib_diff),
             stdout=stdout,
             stderr=stderr,
             returncode=returncode,
         ),
     )
Example #3
0
    def push(self,
             modifiers=None,
             name="runner.cib.push",
             load_key="runner.cib.load",
             instead=None,
             stderr="",
             returncode=0,
             **modifier_shortcuts):
        """
        Create call for pushing cib.
        Cib is taken from the load call by default.

        string name -- key of the call
        list of callable modifiers -- every callable takes etree.Element and
            returns new etree.Element with desired modification.
        string load_key -- key of a call from which stdout can be cib taken
        string instead -- key of call instead of which this new call is to be
            placed
        dict modifier_shortcuts -- a new modifier is generated from each
            modifier shortcut.
            As key there can be keys of MODIFIER_GENERATORS.
            Value is passed into appropriate generator from MODIFIER_GENERATORS.
            For details see pcs_test.tools.fixture_cib (mainly the variable
            MODIFIER_GENERATORS - please refer it when you are adding params
            here)
        """
        cib = modify_cib(
            self.__calls.get(load_key).stdout, modifiers, **modifier_shortcuts)
        self.__calls.place(
            name,
            RunnerCall(
                "cibadmin --replace --verbose --xml-pipe --scope configuration",
                stderr=stderr,
                returncode=returncode,
                check_stdin=create_check_stdin_xml(cib),
            ),
            instead=instead,
        )
Example #4
0
    def push_independent(
        self,
        cib,
        name="runner.cib.push_independent",
        instead=None,
    ):
        """
        Create call for pushing cib.
        Cib is specified as an argument.

        string name -- key of the call
        string cib -- whole cib to push
        string instead -- key of call instead of which this new call is to be
            placed
        """
        self.__calls.place(
            name,
            RunnerCall(
                "cibadmin --replace --verbose --xml-pipe --scope configuration",
                check_stdin=create_check_stdin_xml(cib),
            ),
            instead=instead,
        )
Example #5
0
 def push_diff(
     self,
     name="runner.cib.push_diff",
     cib_diff="resulting diff",
     stdout="",
     stderr="",
     returncode=0
 ):
     """
     Create a call for pushing a diff of CIBs
     string name -- key of the call
     string cib_diff -- the diff of CIBs
     """
     self.__calls.place(
         name,
         RunnerCall(
             "cibadmin --patch --verbose --xml-pipe",
             check_stdin=create_check_stdin_xml(cib_diff),
             stdout=stdout,
             stderr=stderr,
             returncode=returncode,
         ),
     )
Example #6
0
    def push_independent(
        self,
        cib,
        name="runner.cib.push_independent",
        instead=None,
    ):
        """
        Create call for pushing cib.
        Cib is specified as an argument.

        string name -- key of the call
        string cib -- whole cib to push
        string instead -- key of call instead of which this new call is to be
            placed
        """
        self.__calls.place(
            name,
            RunnerCall(
                "cibadmin --replace --verbose --xml-pipe --scope configuration",
                check_stdin=create_check_stdin_xml(cib),
            ),
            instead=instead,
        )