How to use the pypuppetdb.QueryBuilder.LessOperator 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_querybuilder.py View on Github external
def test_less_operator(self):
        assert str(LessOperator("uptime_seconds", 300))\
            == '["<", "uptime_seconds", 300]'
        assert str(LessOperator(
            "producer_timestamp",
            "2016-05-11T23:53:29.962Z"))\
            == '["<", "producer_timestamp", "2016-05-11T23:53:29.962Z"]'
        assert str(LessOperator(['parameter', 'version'], 4.0))\
            == '["<", ["parameter", "version"], 4.0]'
        assert str(LessOperator("report_timestamp",
                                datetime.datetime(2016, 6, 11)))\
            == '["<", "report_timestamp", "2016-06-11 00:00:00"]'
github voxpupuli / pypuppetdb / tests / test_querybuilder.py View on Github external
def test_less_operator(self):
        assert str(LessOperator("uptime_seconds", 300))\
            == '["<", "uptime_seconds", 300]'
        assert str(LessOperator(
            "producer_timestamp",
            "2016-05-11T23:53:29.962Z"))\
            == '["<", "producer_timestamp", "2016-05-11T23:53:29.962Z"]'
        assert str(LessOperator(['parameter', 'version'], 4.0))\
            == '["<", ["parameter", "version"], 4.0]'
        assert str(LessOperator("report_timestamp",
                                datetime.datetime(2016, 6, 11)))\
            == '["<", "report_timestamp", "2016-06-11 00:00:00"]'
github voxpupuli / pypuppetdb / tests / test_querybuilder.py View on Github external
def test_less_operator(self):
        assert str(LessOperator("uptime_seconds", 300))\
            == '["<", "uptime_seconds", 300]'
        assert str(LessOperator(
            "producer_timestamp",
            "2016-05-11T23:53:29.962Z"))\
            == '["<", "producer_timestamp", "2016-05-11T23:53:29.962Z"]'
        assert str(LessOperator(['parameter', 'version'], 4.0))\
            == '["<", ["parameter", "version"], 4.0]'
        assert str(LessOperator("report_timestamp",
                                datetime.datetime(2016, 6, 11)))\
            == '["<", "report_timestamp", "2016-06-11 00:00:00"]'
github voxpupuli / pypuppetdb / tests / test_querybuilder.py View on Github external
def test_less_operator(self):
        assert str(LessOperator("uptime_seconds", 300))\
            == '["<", "uptime_seconds", 300]'
        assert str(LessOperator(
            "producer_timestamp",
            "2016-05-11T23:53:29.962Z"))\
            == '["<", "producer_timestamp", "2016-05-11T23:53:29.962Z"]'
        assert str(LessOperator(['parameter', 'version'], 4.0))\
            == '["<", ["parameter", "version"], 4.0]'
        assert str(LessOperator("report_timestamp",
                                datetime.datetime(2016, 6, 11)))\
            == '["<", "report_timestamp", "2016-06-11 00:00:00"]'
github voxpupuli / puppetboard / puppetboard / dailychart.py View on Github external
def _build_query(env, start, end, certname=None):
    """Build a extract query with optional certname and environment."""
    query = ExtractOperator()
    query.add_field(FunctionOperator('count'))
    query.add_field('status')
    subquery = AndOperator()
    subquery.add(GreaterEqualOperator('producer_timestamp', start))
    subquery.add(LessOperator('producer_timestamp', end))
    if certname is not None:
        subquery.add(EqualsOperator('certname', certname))
    if env != '*':
        subquery.add(EqualsOperator('environment', env))
    query.add_query(subquery)
    query.add_group_by("status")
    return query
github voxpupuli / pypuppetdb / pypuppetdb / QueryBuilder.py View on Github external
def __init__(self, field, value):
        super(LessOperator, self).__init__("<", field, value)