File tree 2 files changed +33
-11
lines changed
2 files changed +33
-11
lines changed Original file line number Diff line number Diff line change 1
1
Examples
2
2
========
3
3
4
- Basic query for nodes using :mod: `pypuppetdb `::
4
+ Basic query for nodes using :mod: `pypuppetdb `:
5
5
6
- import pypuppetdb
7
- import pypuppetdbquery
8
-
9
- pdb = pypuppetdb.connect()
10
-
11
- pdb_ast = pypuppetdbquery.parse(
12
- '(processorcount=4 or processorcount=8) and kernel=Linux')
13
-
14
- for node in pdb.nodes(query=pdb_ast):
15
- print(node)
6
+ .. literalinclude :: ../examples/nodes.py
7
+ :lines: 21-
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file is part of pypuppetdbquery.
4
+ # Copyright © 2016 Chris Boot <[email protected] >
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ """
18
+ Query for nodes using :mod:`pypuppetdb`.
19
+ """
20
+
21
+ import pypuppetdb
22
+ import pypuppetdbquery
23
+
24
+ pdb = pypuppetdb .connect ()
25
+
26
+ pdb_ast = pypuppetdbquery .parse (
27
+ '(processorcount=4 or processorcount=8) and kernel=Linux' )
28
+
29
+ for node in pdb .nodes (query = pdb_ast ):
30
+ print (node )
You can’t perform that action at this time.
0 commit comments