How to use the pypuppetdb.types.Catalog function in pypuppetdb

To help you get started, we’ve selected a few pypuppetdb 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 voxpupuli / pypuppetdb / tests / test_types.py View on Github external
def test_catalog_codeid(self):
        catalog = Catalog('node', [], [], 'unique', None,
                          code_id='somecodeid')
        assert catalog.node == 'node'
        assert catalog.version == 'unique'
        assert catalog.transaction_uuid is None
        assert catalog.resources == {}
        assert catalog.edges == []
        assert str(catalog) == str('node/None')
        assert str(catalog) == str('node/None')
        assert repr(catalog) == str(
            '')
        assert catalog.code_id == 'somecodeid'
github voxpupuli / pypuppetdb / tests / test_types.py View on Github external
def test_catalog_producer(self):
        catalog = Catalog('node', [], [], 'unique', None,
                          producer="puppet01.test.com")
        assert catalog.node == 'node'
        assert catalog.version == 'unique'
        assert catalog.transaction_uuid is None
        assert catalog.resources == {}
        assert catalog.edges == []
        assert catalog.producer == 'puppet01.test.com'
        assert str(catalog) == str('node/None')
        assert str(catalog) == str('node/None')
        assert repr(catalog) == str(
            '')
github voxpupuli / pypuppetdb / tests / test_types.py View on Github external
def test_catalog(self):
        catalog = Catalog('node', [], [], 'unique', None)
        assert catalog.node == 'node'
        assert catalog.version == 'unique'
        assert catalog.transaction_uuid is None
        assert catalog.resources == {}
        assert catalog.edges == []
        assert str(catalog) == str('node/None')
        assert str(catalog) == str('node/None')
        assert repr(catalog) == str(
            '')
github voxpupuli / pypuppetdb / tests / test_types.py View on Github external
def test_catalog_uuid(self):
        catalog = Catalog('node', [], [], 'unique', None,
                          catalog_uuid='univerallyuniqueidentifier')
        assert catalog.node == 'node'
        assert catalog.version == 'unique'
        assert catalog.transaction_uuid is None
        assert catalog.resources == {}
        assert catalog.edges == []
        assert str(catalog) == str('node/None')
        assert str(catalog) == str('node/None')
        assert repr(catalog) == str(
            '')
        assert catalog.catalog_uuid == 'univerallyuniqueidentifier'
github voxpupuli / pypuppetdb / pypuppetdb / api.py View on Github external
and/or paging parameters for this endpoint to prevent large result
        sets or PuppetDB performance bottlenecks.

        :param \*\*kwargs: The rest of the keyword arguments are passed
                           to the _query function.

        :returns: A generator yielding Catalogs
        :rtype: :class:`pypuppetdb.types.Catalog`
        """
        catalogs = self._query('catalogs', **kwargs)

        if type(catalogs) == dict:
            catalogs = [catalogs, ]

        for catalog in catalogs:
            yield Catalog(node=catalog['certname'],
                          edges=catalog['edges']['data'],
                          resources=catalog['resources']['data'],
                          version=catalog['version'],
                          transaction_uuid=catalog['transaction_uuid'],
                          environment=catalog['environment'],
                          code_id=catalog.get('code_id'),
                          catalog_uuid=catalog.get('catalog_uuid'))
github voxpupuli / pypuppetdb / pypuppetdb / api / v4.py View on Github external
and/or paging parameters for this endpoint to prevent large result
        sets or PuppetDB performance bottlenecks.

        :param \*\*kwargs: The rest of the keyword arguments are passed
                           to the _query function.

        :returns: A generator yielding Catalogs
        :rtype: :class:`pypuppetdb.types.Catalog`
        """
        catalogs = self._query('catalogs', **kwargs)

        if type(catalogs) == dict:
            catalogs = [catalogs, ]

        for catalog in catalogs:
            yield Catalog(node=catalog['certname'],
                          edges=catalog['edges']['data'],
                          resources=catalog['resources']['data'],
                          version=catalog['version'],
                          transaction_uuid=catalog['transaction_uuid'],
                          environment=catalog['environment'])
github voxpupuli / pypuppetdb / pypuppetdb / api / v3.py View on Github external
def catalog(self, node):
        """Get the most recent catalog for a given node"""
        c = self._query('catalogs', path=node)
        return Catalog(c['data']['name'],
                       c['data']['edges'],
                       c['data']['resources'],
                       c['data']['version'],
                       c['data']['transaction-uuid'])