Ejemplo n.º 1
0
def load_dcos_conf_template(fpath: Path):
    """Load the DC/OS aggregated configuration template from disk.

    :param fpath: Path, path to template
    """
    try:
        with fpath.open() as f:
            return template.parse_str(f.read())
    except (OSError, RuntimeError) as e:
        raise cr_exc.RCError(f'DC/OS aggregated config: Template: Load:'
                             f' {fpath}: {type(e).__name__}: {e}') from e
Ejemplo n.º 2
0
    def load_dcos_conf_template(fpath: Path):
        """Load the DC/OS aggregated configuration template from disk.

        :param fpath: Path, path to template
        """
        # TODO: Functionality implemented in this method needs to be reused
        #       in other application parts (e.g. CmdConfigUpgrade) and so, it
        #       has been arranged as a standalone function
        #       load_dcos_conf_template().
        #       Thus the CmdConfigSetup is to be moved to use that standalone
        #       function instead of this method to avoid massive code
        #       duplication.
        try:
            with fpath.open() as f:
                return template.parse_str(f.read())
        except (OSError, RuntimeError) as e:
            raise cr_exc.RCError(f'DC/OS aggregated config: Template: Load:'
                                 f' {fpath}: {type(e).__name__}: {e}') from e