ruby-puppetdb 1.0.0.pre4 → 1.0.0.pre5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/find-nodes +0 -3
- data/lib/puppetdb/astnode.rb +2 -0
- data/lib/puppetdb/grammar.y +12 -8
- data/lib/puppetdb/lexer.l +1 -0
- data/lib/puppetdb/lexer.rb +4 -1
- data/lib/puppetdb/parser.rb +111 -82
- data/ruby-puppetdb.gemspec +1 -0
- metadata +22 -10
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3214138ddeb8d78c84115410faff9ee42334d568
|
4
|
+
data.tar.gz: 422cd911879e193cad1ffff25ae2837f41909011
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eacd7d3e08ae98b2779d04410e64a678a9692fe4c533af5d0728e19df2194b26f3bef54413e422725bba156a86794eb3f844e300ffa87a8f472eb17450f244e1
|
7
|
+
data.tar.gz: 83f778424047203ed5a7e0abf0bb5a3fe33819358575c0a0123ca13b715f94e1c7670299cad7849bd908c824eaecc49dd4ead5d32651465aacff03cf1a672905
|
data/bin/find-nodes
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
require 'puppet'
|
5
4
|
require 'puppetdb/connection'
|
6
5
|
require 'optparse'
|
7
6
|
require 'net/http'
|
8
7
|
require 'net/https'
|
9
8
|
|
10
|
-
Puppet.initialize_settings
|
11
|
-
|
12
9
|
options = {:puppetdb_host => "puppetdb",
|
13
10
|
:puppetdb_port => 443,
|
14
11
|
:fact => nil,
|
data/lib/puppetdb/astnode.rb
CHANGED
data/lib/puppetdb/grammar.y
CHANGED
@@ -6,7 +6,7 @@ class PuppetDB::Parser
|
|
6
6
|
token LPAREN RPAREN LBRACK RBRACK LBRACE RBRACE
|
7
7
|
token EQUALS NOTEQUALS MATCH LESSTHAN GREATERTHAN
|
8
8
|
token NOT AND OR
|
9
|
-
token NUMBER STRING BOOLEAN
|
9
|
+
token NUMBER STRING BOOLEAN EXPORTED
|
10
10
|
|
11
11
|
prechigh
|
12
12
|
right NOT
|
@@ -33,14 +33,18 @@ rule
|
|
33
33
|
| string NOTEQUALS string { result = ASTNode.new :booleanop, :not, [ASTNode.new(:exp, :equals, [val[0], val[2]])] }
|
34
34
|
| ressubquery
|
35
35
|
|
36
|
-
ressubquery:
|
37
|
-
|
|
38
|
-
| resparams { result = ASTNode.new :subquery, :resources, [val[0]] }
|
39
|
-
| restype restitle { result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [val[0], val[1]])] }
|
40
|
-
| restitle resparams { result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [val[0], val[1]])] }
|
41
|
-
| restype resparams { result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [val[0], val[1]])] }
|
42
|
-
| restype restitle resparams { result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [val[0], val[1], val[2]])] }
|
36
|
+
ressubquery: resexp { result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [ASTNode.new(:resexported, false), *val[0]])] }
|
37
|
+
| resexported resexp { result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [ASTNode.new(:resexported, true), *val[1]])] }
|
43
38
|
|
39
|
+
resexp: restype { result = [val[0]] }
|
40
|
+
| restitle { result = [val[0]] }
|
41
|
+
| resparams { result = [val[0]] }
|
42
|
+
| restype restitle { result = [val[0], val[1]] }
|
43
|
+
| restitle resparams { result = [val[0], val[1]] }
|
44
|
+
| restype resparams { result = [val[0], val[1]] }
|
45
|
+
| restype restitle resparams { result = [val[0], val[1], val[2]] }
|
46
|
+
|
47
|
+
resexported: EXPORTED
|
44
48
|
restype: STRING { result = ASTNode.new :resourcetype, val[0] }
|
45
49
|
restitle: LBRACK STRING RBRACK { result = ASTNode.new :resourcetitle, val[1] }
|
46
50
|
resparams: LBRACE exp RBRACE { result = val[1] }
|
data/lib/puppetdb/lexer.l
CHANGED
data/lib/puppetdb/lexer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#--
|
2
2
|
# DO NOT MODIFY!!!!
|
3
3
|
# This file is automatically generated by rex 1.0.2
|
4
|
-
# from lexical definition file "puppetdb/lexer.l".
|
4
|
+
# from lexical definition file "lib/puppetdb/lexer.l".
|
5
5
|
#++
|
6
6
|
|
7
7
|
require 'racc/parser'
|
@@ -120,6 +120,9 @@ class Lexer < Racc::Parser
|
|
120
120
|
when (text = ss.scan(/[\w_:]+/))
|
121
121
|
@rex_tokens.push action { [:STRING, text] }
|
122
122
|
|
123
|
+
when (text = ss.scan(/@@/))
|
124
|
+
@rex_tokens.push action { [:EXPORTED, text] }
|
125
|
+
|
123
126
|
else
|
124
127
|
text = ss.string[ss.pos .. -1]
|
125
128
|
raise ScanError, "can not match: '" + text + "'"
|
data/lib/puppetdb/parser.rb
CHANGED
@@ -14,87 +14,96 @@ module PuppetDB
|
|
14
14
|
##### State transition tables begin ###
|
15
15
|
|
16
16
|
racc_action_table = [
|
17
|
-
3, 3,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
3, 3, 14, 14, 15, 15, -29, -29, -29, -29,
|
18
|
+
-29, 4, 4, 33, 36, 13, 13, 12, 12, 3,
|
19
|
+
3, 14, 14, 15, 15, 17, 18, 41, 40, 42,
|
20
|
+
4, 4, 17, 18, 13, 13, 12, 12, 3, 3,
|
21
|
+
14, 14, 15, 15, 14, 14, 15, 15, 31, 4,
|
22
|
+
4, 51, 41, 13, 13, 12, 12, 27, 17, 18,
|
23
|
+
21, 25, 24, 23, 22, 41, 40, 42, 41, 40,
|
24
|
+
15, 15, 50, 16, 17 ]
|
24
25
|
|
25
26
|
racc_action_check = [
|
26
|
-
0,
|
27
|
-
|
28
|
-
3,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
0, 17, 0, 17, 0, 17, 13, 13, 13, 13,
|
28
|
+
13, 0, 17, 16, 19, 0, 17, 0, 17, 15,
|
29
|
+
3, 15, 3, 15, 3, 19, 19, 21, 21, 21,
|
30
|
+
15, 3, 2, 2, 15, 3, 15, 3, 4, 18,
|
31
|
+
4, 18, 4, 18, 8, 9, 8, 9, 14, 4,
|
32
|
+
18, 32, 22, 4, 18, 4, 18, 8, 32, 32,
|
33
|
+
5, 5, 5, 5, 5, 25, 25, 25, 23, 24,
|
34
|
+
10, 28, 31, 1, 35 ]
|
33
35
|
|
34
36
|
racc_action_pointer = [
|
35
|
-
-2,
|
36
|
-
nil,
|
37
|
-
|
37
|
+
-2, 73, 18, 18, 36, 52, nil, nil, 40, 41,
|
38
|
+
64, nil, nil, -2, 31, 17, 13, -1, 37, 11,
|
39
|
+
nil, 11, 36, 52, 52, 49, nil, nil, 65, nil,
|
40
|
+
nil, 67, 44, nil, nil, 60, nil, nil, nil, nil,
|
38
41
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
39
|
-
nil, nil
|
42
|
+
nil, nil ]
|
40
43
|
|
41
44
|
racc_action_default = [
|
42
|
-
-
|
43
|
-
-
|
44
|
-
|
45
|
-
|
46
|
-
-
|
45
|
+
-32, -32, -1, -32, -32, -32, -15, -16, -32, -18,
|
46
|
+
-19, -20, -25, -26, -32, -32, -32, -32, -32, -32,
|
47
|
+
-3, -32, -32, -32, -32, -32, -17, -26, -21, -23,
|
48
|
+
-22, -32, -32, 52, -4, -5, -2, -6, -7, -8,
|
49
|
+
-29, -30, -31, -9, -10, -11, -12, -13, -14, -24,
|
50
|
+
-27, -28 ]
|
47
51
|
|
48
52
|
racc_goto_table = [
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
29, 30, 26, 2, 28, 37, 19, 20, 45, 48,
|
54
|
+
38, 39, 43, 44, 47, 46, 1, nil, 32, 49,
|
55
|
+
34, 35 ]
|
52
56
|
|
53
57
|
racc_goto_check = [
|
54
|
-
|
55
|
-
|
56
|
-
|
58
|
+
11, 11, 7, 2, 10, 3, 2, 2, 3, 3,
|
59
|
+
4, 5, 5, 5, 4, 5, 1, nil, 2, 11,
|
60
|
+
2, 2 ]
|
57
61
|
|
58
62
|
racc_goto_pointer = [
|
59
|
-
nil, 16,
|
63
|
+
nil, 16, 3, -16, -11, -10, nil, -6, nil, nil,
|
64
|
+
-5, -9 ]
|
60
65
|
|
61
66
|
racc_goto_default = [
|
62
|
-
nil, nil, nil,
|
67
|
+
nil, nil, nil, 5, nil, nil, 6, 7, 8, 9,
|
68
|
+
10, 11 ]
|
63
69
|
|
64
70
|
racc_reduce_table = [
|
65
71
|
0, 0, :racc_error,
|
66
|
-
1, 20, :_reduce_none,
|
67
|
-
3, 21, :_reduce_2,
|
68
|
-
2, 21, :_reduce_3,
|
69
|
-
3, 21, :_reduce_4,
|
70
|
-
3, 21, :_reduce_5,
|
71
|
-
3, 21, :_reduce_6,
|
72
|
-
3, 21, :_reduce_7,
|
73
|
-
3, 21, :_reduce_8,
|
74
|
-
3, 21, :_reduce_9,
|
75
|
-
3, 21, :_reduce_10,
|
76
|
-
3, 21, :_reduce_11,
|
77
|
-
3, 21, :_reduce_12,
|
78
|
-
3, 21, :_reduce_13,
|
79
|
-
3, 21, :_reduce_14,
|
80
72
|
1, 21, :_reduce_none,
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
3,
|
88
|
-
|
73
|
+
3, 22, :_reduce_2,
|
74
|
+
2, 22, :_reduce_3,
|
75
|
+
3, 22, :_reduce_4,
|
76
|
+
3, 22, :_reduce_5,
|
77
|
+
3, 22, :_reduce_6,
|
78
|
+
3, 22, :_reduce_7,
|
79
|
+
3, 22, :_reduce_8,
|
80
|
+
3, 22, :_reduce_9,
|
81
|
+
3, 22, :_reduce_10,
|
82
|
+
3, 22, :_reduce_11,
|
83
|
+
3, 22, :_reduce_12,
|
84
|
+
3, 22, :_reduce_13,
|
85
|
+
3, 22, :_reduce_14,
|
86
|
+
1, 22, :_reduce_none,
|
87
|
+
1, 26, :_reduce_16,
|
88
|
+
2, 26, :_reduce_17,
|
89
|
+
1, 27, :_reduce_18,
|
90
|
+
1, 27, :_reduce_19,
|
91
|
+
1, 27, :_reduce_20,
|
92
|
+
2, 27, :_reduce_21,
|
93
|
+
2, 27, :_reduce_22,
|
94
|
+
2, 27, :_reduce_23,
|
89
95
|
3, 27, :_reduce_24,
|
90
|
-
|
91
|
-
1,
|
92
|
-
|
93
|
-
|
96
|
+
1, 28, :_reduce_none,
|
97
|
+
1, 29, :_reduce_26,
|
98
|
+
3, 30, :_reduce_27,
|
99
|
+
3, 31, :_reduce_28,
|
100
|
+
1, 23, :_reduce_29,
|
101
|
+
1, 25, :_reduce_30,
|
102
|
+
1, 24, :_reduce_31 ]
|
94
103
|
|
95
|
-
racc_reduce_n =
|
104
|
+
racc_reduce_n = 32
|
96
105
|
|
97
|
-
racc_shift_n =
|
106
|
+
racc_shift_n = 52
|
98
107
|
|
99
108
|
racc_token_table = {
|
100
109
|
false => 0,
|
@@ -115,9 +124,10 @@ racc_token_table = {
|
|
115
124
|
:OR => 15,
|
116
125
|
:NUMBER => 16,
|
117
126
|
:STRING => 17,
|
118
|
-
:BOOLEAN => 18
|
127
|
+
:BOOLEAN => 18,
|
128
|
+
:EXPORTED => 19 }
|
119
129
|
|
120
|
-
racc_nt_base =
|
130
|
+
racc_nt_base = 20
|
121
131
|
|
122
132
|
racc_use_result_var = true
|
123
133
|
|
@@ -157,6 +167,7 @@ Racc_token_to_s_table = [
|
|
157
167
|
"NUMBER",
|
158
168
|
"STRING",
|
159
169
|
"BOOLEAN",
|
170
|
+
"EXPORTED",
|
160
171
|
"$start",
|
161
172
|
"query",
|
162
173
|
"exp",
|
@@ -164,6 +175,8 @@ Racc_token_to_s_table = [
|
|
164
175
|
"boolean",
|
165
176
|
"number",
|
166
177
|
"ressubquery",
|
178
|
+
"resexp",
|
179
|
+
"resexported",
|
167
180
|
"restype",
|
168
181
|
"restitle",
|
169
182
|
"resparams" ]
|
@@ -271,90 +284,106 @@ module_eval(<<'.,.,', 'grammar.y', 32)
|
|
271
284
|
|
272
285
|
module_eval(<<'.,.,', 'grammar.y', 35)
|
273
286
|
def _reduce_16(val, _values, result)
|
274
|
-
result = ASTNode.new :subquery, :resources, [val[0]]
|
287
|
+
result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [ASTNode.new(:resexported, false), *val[0]])]
|
275
288
|
result
|
276
289
|
end
|
277
290
|
.,.,
|
278
291
|
|
279
292
|
module_eval(<<'.,.,', 'grammar.y', 36)
|
280
293
|
def _reduce_17(val, _values, result)
|
281
|
-
result = ASTNode.new :subquery, :resources, [val[
|
294
|
+
result = ASTNode.new :subquery, :resources, [ASTNode.new(:booleanop, :and, [ASTNode.new(:resexported, true), *val[1]])]
|
282
295
|
result
|
283
296
|
end
|
284
297
|
.,.,
|
285
298
|
|
286
|
-
module_eval(<<'.,.,', 'grammar.y',
|
299
|
+
module_eval(<<'.,.,', 'grammar.y', 38)
|
287
300
|
def _reduce_18(val, _values, result)
|
288
|
-
result =
|
301
|
+
result = [val[0]]
|
289
302
|
result
|
290
303
|
end
|
291
304
|
.,.,
|
292
305
|
|
293
|
-
module_eval(<<'.,.,', 'grammar.y',
|
306
|
+
module_eval(<<'.,.,', 'grammar.y', 39)
|
294
307
|
def _reduce_19(val, _values, result)
|
295
|
-
result =
|
308
|
+
result = [val[0]]
|
296
309
|
result
|
297
310
|
end
|
298
311
|
.,.,
|
299
312
|
|
300
|
-
module_eval(<<'.,.,', 'grammar.y',
|
313
|
+
module_eval(<<'.,.,', 'grammar.y', 40)
|
301
314
|
def _reduce_20(val, _values, result)
|
302
|
-
result =
|
315
|
+
result = [val[0]]
|
303
316
|
result
|
304
317
|
end
|
305
318
|
.,.,
|
306
319
|
|
307
|
-
module_eval(<<'.,.,', 'grammar.y',
|
320
|
+
module_eval(<<'.,.,', 'grammar.y', 41)
|
308
321
|
def _reduce_21(val, _values, result)
|
309
|
-
result =
|
322
|
+
result = [val[0], val[1]]
|
310
323
|
result
|
311
324
|
end
|
312
325
|
.,.,
|
313
326
|
|
314
|
-
module_eval(<<'.,.,', 'grammar.y',
|
327
|
+
module_eval(<<'.,.,', 'grammar.y', 42)
|
315
328
|
def _reduce_22(val, _values, result)
|
316
|
-
result =
|
329
|
+
result = [val[0], val[1]]
|
317
330
|
result
|
318
331
|
end
|
319
332
|
.,.,
|
320
333
|
|
321
334
|
module_eval(<<'.,.,', 'grammar.y', 43)
|
322
335
|
def _reduce_23(val, _values, result)
|
323
|
-
result =
|
336
|
+
result = [val[0], val[1]]
|
324
337
|
result
|
325
338
|
end
|
326
339
|
.,.,
|
327
340
|
|
328
341
|
module_eval(<<'.,.,', 'grammar.y', 44)
|
329
342
|
def _reduce_24(val, _values, result)
|
343
|
+
result = [val[0], val[1], val[2]]
|
344
|
+
result
|
345
|
+
end
|
346
|
+
.,.,
|
347
|
+
|
348
|
+
# reduce 25 omitted
|
349
|
+
|
350
|
+
module_eval(<<'.,.,', 'grammar.y', 47)
|
351
|
+
def _reduce_26(val, _values, result)
|
352
|
+
result = ASTNode.new :resourcetype, val[0]
|
353
|
+
result
|
354
|
+
end
|
355
|
+
.,.,
|
356
|
+
|
357
|
+
module_eval(<<'.,.,', 'grammar.y', 48)
|
358
|
+
def _reduce_27(val, _values, result)
|
330
359
|
result = ASTNode.new :resourcetitle, val[1]
|
331
360
|
result
|
332
361
|
end
|
333
362
|
.,.,
|
334
363
|
|
335
|
-
module_eval(<<'.,.,', 'grammar.y',
|
336
|
-
def
|
364
|
+
module_eval(<<'.,.,', 'grammar.y', 49)
|
365
|
+
def _reduce_28(val, _values, result)
|
337
366
|
result = val[1]
|
338
367
|
result
|
339
368
|
end
|
340
369
|
.,.,
|
341
370
|
|
342
|
-
module_eval(<<'.,.,', 'grammar.y',
|
343
|
-
def
|
371
|
+
module_eval(<<'.,.,', 'grammar.y', 51)
|
372
|
+
def _reduce_29(val, _values, result)
|
344
373
|
result = ASTNode.new :string, val[0]
|
345
374
|
result
|
346
375
|
end
|
347
376
|
.,.,
|
348
377
|
|
349
|
-
module_eval(<<'.,.,', 'grammar.y',
|
350
|
-
def
|
378
|
+
module_eval(<<'.,.,', 'grammar.y', 52)
|
379
|
+
def _reduce_30(val, _values, result)
|
351
380
|
result = ASTNode.new :number, val[0]
|
352
381
|
result
|
353
382
|
end
|
354
383
|
.,.,
|
355
384
|
|
356
|
-
module_eval(<<'.,.,', 'grammar.y',
|
357
|
-
def
|
385
|
+
module_eval(<<'.,.,', 'grammar.y', 53)
|
386
|
+
def _reduce_31(val, _values, result)
|
358
387
|
result = ASTNode.new :boolean, val[0]
|
359
388
|
result
|
360
389
|
end
|
data/ruby-puppetdb.gemspec
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-puppetdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
5
|
-
prerelease: 6
|
4
|
+
version: 1.0.0.pre5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dan Bode
|
@@ -10,8 +9,22 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-04-
|
14
|
-
dependencies:
|
12
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
15
28
|
description: A higher level query language for PuppetDB.
|
16
29
|
email:
|
17
30
|
- dan@puppetlabs.com
|
@@ -62,27 +75,26 @@ files:
|
|
62
75
|
- spec/unit/puppet/parser/functions/query_nodes_spec.rb
|
63
76
|
homepage: https://github.com/dalen/puppet-puppetdbquery
|
64
77
|
licenses: []
|
78
|
+
metadata: {}
|
65
79
|
post_install_message:
|
66
80
|
rdoc_options: []
|
67
81
|
require_paths:
|
68
82
|
- lib
|
69
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
84
|
requirements:
|
72
|
-
- -
|
85
|
+
- - '>='
|
73
86
|
- !ruby/object:Gem::Version
|
74
87
|
version: '0'
|
75
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
89
|
requirements:
|
78
|
-
- -
|
90
|
+
- - '>'
|
79
91
|
- !ruby/object:Gem::Version
|
80
92
|
version: 1.3.1
|
81
93
|
requirements: []
|
82
94
|
rubyforge_project:
|
83
|
-
rubygems_version:
|
95
|
+
rubygems_version: 2.0.3
|
84
96
|
signing_key:
|
85
|
-
specification_version:
|
97
|
+
specification_version: 4
|
86
98
|
summary: Query functions for PuppetDB
|
87
99
|
test_files:
|
88
100
|
- examples/nova_functions.pp
|