How to use the rend.exc function in rend

To help you get started, we’ve selected a few rend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saltstack / idem / tests / unit / test_basic.py View on Github external
def test_dup_keys():
    with pytest.raises(rend.exc.RenderException):
        ret = run_sls(['dupkeys'])
github saltstack / heist / tests / unit / roster / test_roster.py View on Github external
async def test_read_rend_exc(self, mock_hub: testing.MockHub):
        '''
        test heist.roster.init.read when a rend.exc is raised
        '''
        # Setup
        roster = 'flat'
        mock_hub.roster.flat.read.side_effect = rend.exc.RenderException("Jinja error '}'")

        # Execute
        assert not await heist.roster.init.read(mock_hub, roster)

        # Verify
        mock_hub.roster.flat.read.assert_called_once()
github saltstack / heist / heist / roster / init.py View on Github external
async def read(hub, roster: str) -> List[Dict[str, Any]]:
    '''
    Given the rosters to read in, the tgt and the tgt_type
    '''
    ret = []

    try:
        ready = await getattr(hub, f'roster.{roster}.read')()
    except rend.exc.RenderException as exc:
        log.critical(f'Could not render the {roster} roster, error: {exc.args[0]}')
        return False

    if not ready:
        log.critical(f'The roster {roster} did not return data when rendered')
        return False

    if not isinstance(ready, dict):
        log.critical(f'The roster {roster} is not formatted correctly')
        return False

    for id_, condition in ready.items():
        if not isinstance(condition, dict):
            log.critical(f'The roster {roster} is not formatted correctly.')
            return False
        if 'id' not in condition:

rend

A collection of tools to render text files into data structures

Apache-2.0
Latest version published 1 year ago

Package Health Score

47 / 100
Full package analysis

Popular rend functions