Page MenuHomePhabricator

Forbid quoted booleans in puppet manifests
Closed, ResolvedPublic

Description

We were badly bitten earlier by a mismatch between 'true' and true. Jenkins should scan all .pp files and reject anything with

'true'
'false
'True'
'False'
'TRUE'
etc.

I have the feeling we discussed and rejected this in the past, but I'm mad about it again.

Event Timeline

Andrew raised the priority of this task from to Needs Triage.
Andrew updated the task description. (Show Details)
Andrew subscribed.

Seems like we want to enable the relevant puppet-lint check http://puppet-lint.com/checks/quoted_booleans/

Unfortunately some of our classes expect quoted boolean and there is a bunch of crazy equality check such as: if $foo == 'true' which would not match when $foo = True.

The test is disabled in operations/puppet.git via the file /.puppet-lint.rc:

# "true" and "false" are everywhere.
--no-quoted_booleans-check

So one can send a change for review without the line and look at the puppet-lint jobs.

Change 241111 had a related patch set uploaded (by Hashar):
puppet-lint: enable quoted_booleans-check

https://gerrit.wikimedia.org/r/241111

Only the quoted_booleans warnings (71 of 'em):

118:39:24 ./manifests/role/gerrit.pp:65 WARNING quoted boolean value found (quoted_booleans)
218:39:24 ./manifests/role/gerrit.pp:77 WARNING quoted boolean value found (quoted_booleans)
318:39:24 ./manifests/role/gerrit.pp:90 WARNING quoted boolean value found (quoted_booleans)
418:39:24 ./manifests/role/graphite.pp:266 WARNING quoted boolean value found (quoted_booleans)
518:39:24 ./manifests/role/lists.pp:136 WARNING quoted boolean value found (quoted_booleans)
618:39:24 ./manifests/role/lists.pp:137 WARNING quoted boolean value found (quoted_booleans)
718:39:24 ./manifests/role/diamond.pp:25 WARNING quoted boolean value found (quoted_booleans)
818:39:24 ./manifests/role/puppetmaster.pp:50 WARNING quoted boolean value found (quoted_booleans)
918:39:24 ./manifests/role/grafana.pp:16 WARNING quoted boolean value found (quoted_booleans)
1018:39:24 ./manifests/role/analytics/hadoop.pp:403 WARNING quoted boolean value found (quoted_booleans)
1118:39:24 ./manifests/role/analytics/hadoop.pp:527 WARNING quoted boolean value found (quoted_booleans)
1218:39:24 ./manifests/role/analytics/hadoop.pp:533 WARNING quoted boolean value found (quoted_booleans)
1318:39:24 ./manifests/role/analytics/hadoop.pp:689 WARNING quoted boolean value found (quoted_booleans)
1418:39:24 ./manifests/role/analytics/kafka.pp:219 WARNING quoted boolean value found (quoted_booleans)
1518:39:24 ./manifests/role/analytics/refinery.pp:149 WARNING quoted boolean value found (quoted_booleans)
1618:39:24 ./manifests/role/analytics/refinery.pp:157 WARNING quoted boolean value found (quoted_booleans)
1718:39:24 ./manifests/role/analytics/refinery.pp:165 WARNING quoted boolean value found (quoted_booleans)
1818:39:24 ./manifests/role/analytics/refinery.pp:173 WARNING quoted boolean value found (quoted_booleans)
1918:39:51 ./manifests/site.pp:151 WARNING quoted boolean value found (quoted_booleans)
2018:39:51 ./manifests/site.pp:1815 WARNING quoted boolean value found (quoted_booleans)
2118:39:51 ./manifests/site.pp:1888 WARNING quoted boolean value found (quoted_booleans)
2218:39:51 ./manifests/site.pp:1894 WARNING quoted boolean value found (quoted_booleans)
2318:39:51 ./manifests/site.pp:2211 WARNING quoted boolean value found (quoted_booleans)
2418:39:51 ./manifests/site.pp:2292 WARNING quoted boolean value found (quoted_booleans)
2518:39:51 ./modules/monitoring/manifests/graphite_anomaly.pp:61 WARNING quoted boolean value found (quoted_booleans)
2618:39:51 ./modules/monitoring/manifests/graphite_anomaly.pp:62 WARNING quoted boolean value found (quoted_booleans)
2718:39:51 ./modules/monitoring/manifests/graphite_threshold.pp:65 WARNING quoted boolean value found (quoted_booleans)
2818:39:51 ./modules/monitoring/manifests/graphite_threshold.pp:66 WARNING quoted boolean value found (quoted_booleans)
2918:39:51 ./modules/monitoring/manifests/host.pp:9 WARNING quoted boolean value found (quoted_booleans)
3018:39:51 ./modules/monitoring/manifests/host.pp:28 WARNING quoted boolean value found (quoted_booleans)
3118:39:51 ./modules/monitoring/manifests/ganglia.pp:83 WARNING quoted boolean value found (quoted_booleans)
3218:39:51 ./modules/monitoring/manifests/ganglia.pp:84 WARNING quoted boolean value found (quoted_booleans)
3318:39:51 ./modules/monitoring/manifests/service.pp:8 WARNING quoted boolean value found (quoted_booleans)
3418:39:51 ./modules/monitoring/manifests/service.pp:9 WARNING quoted boolean value found (quoted_booleans)
3518:39:51 ./modules/monitoring/manifests/service.pp:31 WARNING quoted boolean value found (quoted_booleans)
3618:39:51 ./modules/monitoring/manifests/service.pp:36 WARNING quoted boolean value found (quoted_booleans)
3718:39:51 ./modules/monitoring/manifests/service.pp:41 WARNING quoted boolean value found (quoted_booleans)
3818:39:51 ./modules/monitoring/manifests/service.pp:46 WARNING quoted boolean value found (quoted_booleans)
3918:39:51 ./modules/monitoring/manifests/service.pp:51 WARNING quoted boolean value found (quoted_booleans)
4018:39:51 ./modules/monitoring/manifests/service.pp:56 WARNING quoted boolean value found (quoted_booleans)
4118:39:51 ./modules/role/manifests/cache/kafka/webrequest.pp:91 WARNING quoted boolean value found (quoted_booleans)
4218:39:51 ./modules/role/manifests/cache/kafka/webrequest.pp:105 WARNING quoted boolean value found (quoted_booleans)
4318:39:51 ./modules/puppetmaster/manifests/ssl.pp:3 WARNING quoted boolean value found (quoted_booleans)
4418:39:51 ./modules/puppetmaster/manifests/ssl.pp:36 WARNING quoted boolean value found (quoted_booleans)
4518:39:51 ./modules/webserver/manifests/apache/site.pp:21 WARNING quoted boolean value found (quoted_booleans)
4618:39:51 ./modules/webserver/manifests/php5.pp:6 WARNING quoted boolean value found (quoted_booleans)
4718:39:51 ./modules/diamond/manifests/collector/extendedexim.pp:21 WARNING quoted boolean value found (quoted_booleans)
4818:39:51 ./modules/diamond/manifests/collector/localcrontab.pp:21 WARNING quoted boolean value found (quoted_booleans)
4918:39:51 ./modules/diamond/manifests/init.pp:108 WARNING quoted boolean value found (quoted_booleans)
5018:39:51 ./modules/diamond/manifests/init.pp:109 WARNING quoted boolean value found (quoted_booleans)
5118:39:51 ./modules/interface/manifests/tun6to4.pp:2 WARNING quoted boolean value found (quoted_booleans)
5218:39:51 ./modules/interface/manifests/tun6to4.pp:20 WARNING quoted boolean value found (quoted_booleans)
5318:39:51 ./modules/interface/manifests/tun6to4.pp:32 WARNING quoted boolean value found (quoted_booleans)
5418:39:51 ./modules/interface/manifests/tagged.pp:35 WARNING quoted boolean value found (quoted_booleans)
5518:39:51 ./modules/interface/manifests/tagged.pp:51 WARNING quoted boolean value found (quoted_booleans)
5618:39:51 ./modules/interface/manifests/tagged.pp:63 WARNING quoted boolean value found (quoted_booleans)
5718:39:51 ./modules/varnish/manifests/instance.pp:55 WARNING quoted boolean value found (quoted_booleans)
5818:39:51 ./modules/openstack/manifests/nova/compute.pp:197 WARNING quoted boolean value found (quoted_booleans)
5918:39:51 ./modules/dataset/manifests/rsync/default.pp:2 WARNING quoted boolean value found (quoted_booleans)
6018:39:51 ./modules/lvs/manifests/monitor_service_http_https.pp:6 WARNING quoted boolean value found (quoted_booleans)
6118:39:51 ./modules/lvs/manifests/monitor_service_http_https.pp:13 WARNING quoted boolean value found (quoted_booleans)
6218:39:51 ./modules/lvs/manifests/monitor_service_http_https.pp:49 WARNING quoted boolean value found (quoted_booleans)
6318:39:51 ./modules/cassandra/manifests/init.pp:237 WARNING quoted boolean value found (quoted_booleans)
6418:39:51 ./modules/cassandra/manifests/init.pp:239 WARNING quoted boolean value found (quoted_booleans)
6518:39:51 ./modules/cassandra/manifests/init.pp:243 WARNING quoted boolean value found (quoted_booleans)
6618:39:51 ./modules/cassandra/manifests/init.pp:244 WARNING quoted boolean value found (quoted_booleans)
6718:39:51 ./modules/cassandra/manifests/init.pp:245 WARNING quoted boolean value found (quoted_booleans)
6818:39:51 ./modules/scap/manifests/proxy.pp:10 WARNING quoted boolean value found (quoted_booleans)
6918:39:51 ./modules/nrpe/manifests/monitor_systemd_unit_state.pp:22 WARNING quoted boolean value found (quoted_booleans)
7018:39:51 ./modules/nrpe/manifests/monitor_systemd_unit_state.pp:24 WARNING quoted boolean value found (quoted_booleans)
7118:39:51 ./modules/nrpe/manifests/monitor_service.pp:33 WARNING quoted boolean value found (quoted_booleans)

Change 241235 had a related patch set uploaded (by Andrew Bogott):
Rsync: Unquote booleans

https://gerrit.wikimedia.org/r/241235

Change 241236 had a related patch set uploaded (by Andrew Bogott):
Logstash: Fixed a quoted boolean in a code comment.

https://gerrit.wikimedia.org/r/241236

Change 241237 had a related patch set uploaded (by Andrew Bogott):
interface: dequote booleans

https://gerrit.wikimedia.org/r/241237

Change 241238 had a related patch set uploaded (by Andrew Bogott):
Cassandra: dequote some booleans.

https://gerrit.wikimedia.org/r/241238

Change 241239 had a related patch set uploaded (by Andrew Bogott):
Grafana: dequote booleans.

https://gerrit.wikimedia.org/r/241239

Change 241240 had a related patch set uploaded (by Andrew Bogott):
Gerrit role: dequote booleans

https://gerrit.wikimedia.org/r/241240

Change 241241 had a related patch set uploaded (by Andrew Bogott):
Mark salt grain bool values with # lint:ignore:quoted_booleans

https://gerrit.wikimedia.org/r/241241

Change 241242 had a related patch set uploaded (by Andrew Bogott):
webserver::php5 unquote a boolean.

https://gerrit.wikimedia.org/r/241242

Change 241243 had a related patch set uploaded (by Andrew Bogott):
Webserver ca: disable the quoted-bool lint check

https://gerrit.wikimedia.org/r/241243

Change 241244 had a related patch set uploaded (by Andrew Bogott):
Diamond: Turn off lint check for quoted bools.

https://gerrit.wikimedia.org/r/241244

Change 241245 had a related patch set uploaded (by Andrew Bogott):
Disable quoted_boolean lint check around is_virtual refs.

https://gerrit.wikimedia.org/r/241245

Change 241246 had a related patch set uploaded (by Andrew Bogott):
Root out a long chain of quoted bools in nagios/icinga/nrpe

https://gerrit.wikimedia.org/r/241246

A gotcha is the puppet-lint check for boolean is only a warning. In Jenkins we have two jobs:

puppetlint-lenient : solely process errors and votes -1 on failure
puppetlint-strict : does warning as well but is not voting

So even if we fix the boolean quotes, the errors will only be in the -strict job and would not cause a -1 vote for now.

Luckily there are only a few warnings left. If we solved them we can remove the -lenient job and make the -strict one voting. This way warnings will cause a -1 as well :-)

Change 241246 merged by Andrew Bogott:
Root out a long chain of quoted bools in nagios/icinga/nrpe

https://gerrit.wikimedia.org/r/241246

Change 241236 merged by Andrew Bogott:
Logstash: Fixed a quoted boolean in a code comment.

https://gerrit.wikimedia.org/r/241236

Change 241235 merged by Andrew Bogott:
Rsync: Unquote booleans

https://gerrit.wikimedia.org/r/241235

Change 242170 had a related patch set uploaded (by Andrew Bogott):
Dequote one more nrpe critical setting

https://gerrit.wikimedia.org/r/242170

Change 242171 had a related patch set uploaded (by Andrew Bogott):
dataset: Remove needless quotes around a 'true'

https://gerrit.wikimedia.org/r/242171

Change 241237 merged by Andrew Bogott:
interface: dequote booleans

https://gerrit.wikimedia.org/r/241237

Change 241239 merged by Andrew Bogott:
Grafana: dequote booleans.

https://gerrit.wikimedia.org/r/241239

Change 241240 merged by Andrew Bogott:
Gerrit role: dequote booleans

https://gerrit.wikimedia.org/r/241240

Change 241241 merged by Andrew Bogott:
Mark salt grain bool values with # lint:ignore:quoted_booleans

https://gerrit.wikimedia.org/r/241241

Change 241242 merged by Andrew Bogott:
webserver::php5 unquote a boolean.

https://gerrit.wikimedia.org/r/241242

Change 241243 merged by Andrew Bogott:
Webserver ca: disable the quoted-bool lint check

https://gerrit.wikimedia.org/r/241243

Change 241244 merged by Andrew Bogott:
Diamond: Turn off lint check for quoted bools.

https://gerrit.wikimedia.org/r/241244

Change 241245 merged by Andrew Bogott:
Disable quoted_boolean lint check around is_virtual refs.

https://gerrit.wikimedia.org/r/241245

Change 242170 merged by Andrew Bogott:
Dequote one more nrpe critical setting

https://gerrit.wikimedia.org/r/242170

Change 242171 merged by Andrew Bogott:
dataset: Remove needless quotes around a 'true'

https://gerrit.wikimedia.org/r/242171

hashar triaged this task as Medium priority.
hashar moved this task from Repo setup to In progress on the Continuous-Integration-Config board.

Change 241238 merged by Andrew Bogott:
Cassandra: dequote some booleans.

https://gerrit.wikimedia.org/r/241238

Change 243176 had a related patch set uploaded (by Andrew Bogott):
Varnish: Add lint:ignore:quoted_booleans around a boolean that needs quoting.

https://gerrit.wikimedia.org/r/243176

Change 243176 merged by Andrew Bogott:
Varnish: Add lint:ignore:quoted_booleans around a boolean that needs quoting.

https://gerrit.wikimedia.org/r/243176

Change 241111 merged by Andrew Bogott:
puppet-lint: enable quoted_booleans-check

https://gerrit.wikimedia.org/r/241111

These are now caught by the strict lint check. That check isn't voting, however.

Change 522992 had a related patch set uploaded (by CDanis; owner: CDanis):
[operations/puppet@production] nrpe: $critical is a boolean, NOT a string! 😤

https://gerrit.wikimedia.org/r/522992

Change 522992 merged by CDanis:
[operations/puppet@production] nrpe: $critical is a boolean, NOT a string! 😤

https://gerrit.wikimedia.org/r/522992