puppetdb_query 0.0.42 → 0.1.1
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 +4 -4
- data/lib/puppetdb_query/to_mongo.rb +8 -2
- data/lib/puppetdb_query/tokenizer.rb +2 -0
- data/lib/puppetdb_query/version.rb +1 -1
- data/spec/puppetdb_query/parser_spec.rb +1 -1
- data/spec/puppetdb_query/to_mongo_spec.rb +6 -6
- data/spec/puppetdb_query/tokenizer_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9357a22b2ac46f39cfc098965ebb11c89880cc4f
|
4
|
+
data.tar.gz: 209a291011f8f606f6234848e5dba9dc5bd5b955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed6cb32cab631aa429555e996475353551c811c61294f65b52a16f621e187a6196ab2523287690670607054a3cb11725faad993668f0ab2a367025f59ac4707f
|
7
|
+
data.tar.gz: a5f4650072a8ec5b1112933651d79bd63e6dd4078f36ae88a1f8d42c92437fdac63c5adead618508948b265b780ddbb7acc10ef8be10c328b0a6c916cc83acc8
|
@@ -48,9 +48,9 @@ module PuppetDBQuery
|
|
48
48
|
# see https://jira.mongodb.org/browse/SERVER-10708
|
49
49
|
{ :$nor => terms }
|
50
50
|
when :_equal
|
51
|
-
{ term.args[0] => (term.args[1]
|
51
|
+
{ term.args[0] => stringify(term.args[1]) }
|
52
52
|
when :_not_equal
|
53
|
-
{ term.args[0] => { :$ne => (term.args[1]
|
53
|
+
{ term.args[0] => { :$ne => stringify(term.args[1]) } }
|
54
54
|
when :_match
|
55
55
|
{ term.args[0] => { :$regex => term.args[1].to_s } }
|
56
56
|
when :_in
|
@@ -69,5 +69,11 @@ module PuppetDBQuery
|
|
69
69
|
end
|
70
70
|
# rubocop:enable Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity,Metrics/AbcSize
|
71
71
|
# rubocop:enable Metrics/MethodLength
|
72
|
+
|
73
|
+
def stringify(value)
|
74
|
+
return value if value == :null
|
75
|
+
return value.to_s if value.is_a?(Symbol)
|
76
|
+
value
|
77
|
+
end
|
72
78
|
end
|
73
79
|
end
|
@@ -9,7 +9,7 @@ describe PuppetDBQuery::Parser do
|
|
9
9
|
[PuppetDBQuery::Term.new(PuppetDBQuery::Parser::EQUAL).add(:hostname, "puppetdb-mike-217922")]
|
10
10
|
],
|
11
11
|
[ 'disable_puppet = true',
|
12
|
-
[PuppetDBQuery::Term.new(PuppetDBQuery::Parser::EQUAL).add(:disable_puppet,
|
12
|
+
[PuppetDBQuery::Term.new(PuppetDBQuery::Parser::EQUAL).add(:disable_puppet, true)]
|
13
13
|
],
|
14
14
|
[ 'fqdn~"app-dev" and group=develop and vertical~tracking and cluster_color~BLUE',
|
15
15
|
[PuppetDBQuery::Term.new(PuppetDBQuery::Parser::AND)
|
@@ -8,7 +8,7 @@ describe PuppetDBQuery::ToMongo do
|
|
8
8
|
{ hostname: "puppetdb-mike-217922" }
|
9
9
|
],
|
10
10
|
[ 'disable_puppet = true',
|
11
|
-
{ disable_puppet:
|
11
|
+
{ disable_puppet: true }
|
12
12
|
],
|
13
13
|
[ 'fqdn~"app-dev" and group=develop and vertical~tracking and cluster_color~BLUE',
|
14
14
|
{ :$and => [
|
@@ -27,7 +27,7 @@ describe PuppetDBQuery::ToMongo do
|
|
27
27
|
]
|
28
28
|
}
|
29
29
|
],
|
30
|
-
[ '(group="develop-ci" or group=develop or group=mock) and operatingsystemmajrelease=
|
30
|
+
[ '(group="develop-ci" or group=develop or group=mock) and operatingsystemmajrelease=6',
|
31
31
|
{ :$and => [
|
32
32
|
{ :$or => [
|
33
33
|
{ group: "develop-ci" },
|
@@ -35,7 +35,7 @@ describe PuppetDBQuery::ToMongo do
|
|
35
35
|
{ group: "mock" }
|
36
36
|
]
|
37
37
|
},
|
38
|
-
{ operatingsystemmajrelease:
|
38
|
+
{ operatingsystemmajrelease: 6 }
|
39
39
|
]
|
40
40
|
}
|
41
41
|
],
|
@@ -57,9 +57,9 @@ describe PuppetDBQuery::ToMongo do
|
|
57
57
|
{ :$and => [
|
58
58
|
{ server_type: { :$regex => "mesos-magr" } },
|
59
59
|
{ group: "ops-ci" },
|
60
|
-
{ operatingsystemmajrelease:
|
61
|
-
{ vmtest_vm: { :$ne =>
|
62
|
-
{ disable_puppet: { :$ne =>
|
60
|
+
{ operatingsystemmajrelease: 7 },
|
61
|
+
{ vmtest_vm: { :$ne => true } },
|
62
|
+
{ disable_puppet: { :$ne => true } },
|
63
63
|
{ puppet_artifact_version: { :$ne => "NO_VERSION_CHECK" } }
|
64
64
|
]
|
65
65
|
}
|
@@ -8,7 +8,7 @@ describe PuppetDBQuery::Tokenizer do
|
|
8
8
|
[:hostname, :_equal, "puppetdb-mike-217922"]
|
9
9
|
],
|
10
10
|
[ 'disable_puppet = true',
|
11
|
-
[:disable_puppet, :_equal,
|
11
|
+
[:disable_puppet, :_equal, true]
|
12
12
|
],
|
13
13
|
[ 'fqdn~"app-dev" and group=develop and vertical~tracking and cluster_color~BLUE',
|
14
14
|
[:fqdn, :_match, "app-dev", :_and, :group, :_equal, :develop, :_and, :vertical, :_match,
|
@@ -29,8 +29,8 @@ describe PuppetDBQuery::Tokenizer do
|
|
29
29
|
[ "server_type~'mesos-magr' and group='ops-ci' and operatingsystemmajrelease=7 and" \
|
30
30
|
" vmtest_vm!=true and disable_puppet!=true and puppet_artifact_version!=NO_VERSION_CHECK",
|
31
31
|
[:server_type, :_match, "mesos-magr", :_and, :group, :_equal, "ops-ci", :_and,
|
32
|
-
:operatingsystemmajrelease, :_equal, 7, :_and, :vmtest_vm, :_not_equal,
|
33
|
-
:disable_puppet, :_not_equal,
|
32
|
+
:operatingsystemmajrelease, :_equal, 7, :_and, :vmtest_vm, :_not_equal, true, :_and,
|
33
|
+
:disable_puppet, :_not_equal, true, :_and, :puppet_artifact_version, :_not_equal,
|
34
34
|
:NO_VERSION_CHECK]
|
35
35
|
],
|
36
36
|
].freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppetdb_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Meyling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|