Пример #1
0
def config(node: CephNode, data: List) -> None:
    """
    Writes the haproxy.cfg configuration file.

    Args:
        node:   Haproxy client node
        data:   A list having rgw endpoints(ip_address & port)
    Returns:
        None
    Raises:
        CommandFailed
    """
    LOG.info("Generating the HAproxy.cfg file.")
    templ = Template(HAPRX_CONF)
    conf = templ.render(data=data)

    conf_file = node.remote_file(file_name="/etc/haproxy/haproxy.cfg",
                                 file_mode="w")
    conf_file.write(conf)
    conf_file.flush()
Пример #2
0
def config(node: CephNode, data: List) -> None:
    """
    Writes the COS Bench controller configuration file.

    Args:
        node:   The node that is designated to be a COS controller
        data:   A list of dictionaries having driver details (name & ip_address)
    Returns:
        None
    Raises:
        CommandFailed
    """
    LOG.info("Generating the COS Bench controller file.")
    templ = Template(CTRL_CONF)
    conf = templ.render(data=data)

    conf_file = node.remote_file(
        file_name="/opt/cosbench/conf/controller.conf", file_mode="w")
    conf_file.write(conf)
    conf_file.flush()
Пример #3
0
def _write_remote_file(node: CephNode, file_name: str, content: str) -> None:
    """
    Copies the provide content to the specified file on the given node.

    Args:
        node        The target system
        file_name   The name of the remote file to which the content needs to be written
        content     The content of the file to be written

    Returns:
          None

    Raises:
          CommandFailed
    """
    LOG.debug(f"Writing to remote file {file_name}")
    file_handle = node.remote_file(sudo=True, file_mode="w", file_name=file_name)
    file_handle.write(data=content)
    file_handle.flush()
    file_handle.close()