Source code for fixtures.disable_forgery_protection

from cfme.utils.log import logger
import pytest
from cfme.utils.ssh import SSHClient
import time


[docs]@pytest.yield_fixture(scope='session') def disable_forgery_protection(): starttime = time.time() with SSHClient() as ssh_client: logger.info('Turning off "allow_forgery_protection"') ssh_client.run_command( "sed -i \'s/allow_forgery_protection = true/allow_forgery_protection = false/\' " "/var/www/miq/vmdb/config/environments/production.rb") ssh_client.run_command("service evmserverd restart") timediff = time.time() - starttime logger.info('Turned off "allow_forgery_protection" in: {}'.format(timediff)) yield starttime = time.time() with SSHClient() as ssh_client: logger.info('Turning on "allow_forgery_protection"') ssh_client.run_command( "sed -i \'s/allow_forgery_protection = false/allow_forgery_protection = true/\' " "/var/www/miq/vmdb/config/environments/production.rb") ssh_client.run_command("service evmserverd restart") timediff = time.time() - starttime logger.info('Turned on "allow_forgery_protection" in: {}'.format(timediff))