def _check_rolecheck_backup_failure(self, host):
        result = tasks.ipa_backup(host, raiseonerr=False)
        assert result.returncode == 1
        assert "Error: Local roles" in result.stderr_text
        assert "do not match globally used roles" in result.stderr_text

        result = tasks.ipa_backup(host, disable_role_check=True)
        assert result.returncode == 0
        assert "Warning: Local roles" in result.stderr_text
        assert "do not match globally used roles" in result.stderr_text
 def test_backup_restore(self):
     """
     TestCase:
     http://www.freeipa.org/page/V4/Replica_Promotion/Test_plan#Test_case:
     _ipa-restore_after_domainlevel_raise_restores_original_domain_level
     """
     command = ["ipa", "topologysegment-find", DOMAIN_SUFFIX_NAME]
     tasks.install_replica(self.master, self.replicas[0])
     backup_file = tasks.ipa_backup(self.master)
     self.master.run_command(
         ["ipa", "domainlevel-set",
          str(DOMAIN_LEVEL_1)])
     # We need to give the server time to merge 2 one-way segments into one
     time.sleep(10)
     result = self.master.run_command(command)
     found1 = result.stdout_text.rfind("1 segment matched")
     assert (found1 > 0), result.stdout_text
     tasks.ipa_restore(self.master, backup_file)
     result2 = self.master.run_command(command, raiseonerr=False)
     found2 = result2.stdout_text.rfind("0 segments matched")
     assert (found2 > 0), result2.stdout_text
 def _check_rolecheck_backup_success(self, host):
     result = tasks.ipa_backup(host)
     assert result.returncode == 0
     assert "Local roles match globally used roles, proceeding." \
         in result.stderr_text