Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'
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(
'')
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(
'')
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'
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'))
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'])
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'])