def get_apache_configurator(config_path, vhost_path, config_dir, work_dir, version=(2, 4, 7), conf=None):
 backups = os.path.join(work_dir, 'backups')
 mock_le_config = mock.MagicMock(apache_server_root=config_path, apache_vhost_root=vhost_path, apache_le_vhost_ext=constants.os_constant('le_vhost_ext'), apache_challenge_location=config_path, backup_dir=backups, config_dir=config_dir, temp_checkpoint_dir=os.path.join(work_dir, 'temp_checkpoints'), in_progress_dir=os.path.join(backups, 'IN_PROGRESS'), work_dir=work_dir)
 with mock.patch('certbot_apache.configurator.util.run_script'):
  with mock.patch('certbot_apache.configurator.util.exe_exists') as mock_exe_exists:
   mock_exe_exists.return_value = True
   with mock.patch('certbot_apache.parser.ApacheParser.update_runtime_variables'):
    config = configurator.ApacheConfigurator(config=mock_le_config, name='apache', version=version)
    if (conf is not None):
     config.conf = conf
    config.prepare()
 return config

def get_apache_configurator ( config_path , vhost_path , config_dir , work_dir , version = ( 2 , 4 , 7 ) , conf = None ) : backups = os . path . join ( work_dir , 'backups' ) mock_le_config = mock . MagicMock ( apache_server_root = config_path , apache_vhost_root = vhost_path , apache_le_vhost_ext = constants . os_constant ( 'le_vhost_ext' ) , apache_challenge_location = config_path , backup_dir = backups , config_dir = config_dir , temp_checkpoint_dir = os . path . join ( work_dir , 'temp_checkpoints' ) , in_progress_dir = os . path . join ( backups , 'IN_PROGRESS' ) , work_dir = work_dir ) with mock . patch ( 'certbot_apache.configurator.util.run_script' ) : with mock . patch ( 'certbot_apache.configurator.util.exe_exists' ) as mock_exe_exists : mock_exe_exists . return_value = True with mock . patch ( 'certbot_apache.parser.ApacheParser.update_runtime_variables' ) : config = configurator . ApacheConfigurator ( config = mock_le_config , name = 'apache' , version = version ) if ( conf is not None ) : config . conf = conf config . prepare ( ) return config
create an apache configurator with the specified options .