def push_cib(self, modifiers=None, name="env.push_cib", load_key="runner.cib.load", wait=False, exception=None, instead=None, **modifier_shortcuts): """ Create call for pushing cib. 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|False wait -- wait for pacemaker idle Exception|None exception -- exception that should raise env.push_cib 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_xml = modify_cib( self.__calls.get(load_key).stdout, modifiers, **modifier_shortcuts) self.__calls.place(name, PushCibCall(cib_xml, wait=wait, exception=exception), instead=instead)
def load( self, modifiers=None, name="runner.cib.load", filename=None, before=None, returncode=0, stderr=None, instead=None, **modifier_shortcuts ): """ Create call for loading cib. string name -- key of the call list of callable modifiers -- every callable takes etree.Element and returns new etree.Element with desired modification. string filename -- points to file with cib in the content string before -- key of call before which this new call is to be placed int returncode string stderr 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) """ if(returncode != 0 or stderr is not None) and ( modifiers is not None or filename is not None or modifier_shortcuts ): raise AssertionError( "Do not combine parameters 'returncode' and 'stderr' with" " parameters 'modifiers', 'filename' and 'modifier_shortcuts'" ) command = "cibadmin --local --query" if returncode != 0: call = RunnerCall(command, stderr=stderr, returncode=returncode) else: cib = modify_cib( open(rc(filename if filename else self.cib_filename)).read(), modifiers, **modifier_shortcuts ) call = RunnerCall(command, stdout=cib) self.__calls.place(name, call, before=before, instead=instead)
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, )