def test_agent_config_filename(self):
     """Testing method or function named agent_config_filename."""
     # Test
     agent_program = 'koala_bear'
     _config_directory = log.check_environment()
     config_directory = os.path.expanduser(_config_directory)
     expected = ('{}{}{}.yaml'.format(config_directory, os.sep,
                                      agent_program))
     result = configuration.agent_config_filename(agent_program)
     self.assertEqual(result, expected)
예제 #2
0
    def config_directory(self):
        """Get config_directory.

        Args:
            None

        Returns:
            result: result

        """
        # Return
        result = log.check_environment()
        return result
예제 #3
0
def agent_config_filename(agent_program):
    """Get the configuration file name.

    Args:
        agent_program: Agent program name

    Returns:
        result: Name of file

    """
    # Get the configuration directory
    # Expand linux ~ notation for home directories if provided.
    _config_directory = log.check_environment()
    config_directory = os.path.expanduser(_config_directory)
    result = '{}{}{}.yaml'.format(config_directory, os.sep, agent_program)
    return result
예제 #4
0
def _config_reader(filename):
    """Read a configuration file.

    Args:
        filename: Name of file to read

    Returns:
        config_dict: Dict representation of YAML in the file

    """
    # Get the configuration directory
    # Expand linux ~ notation for home directories if provided.
    _config_directory = log.check_environment()
    config_directory = os.path.expanduser(_config_directory)
    config_file = '{}{}{}'.format(config_directory, os.sep, filename)
    config_dict = files.read_yaml_file(config_file)
    return config_dict