return code should not be always 0

Bug #2021977 reported by Robert Gildein
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Juju Lint
Triaged
Medium
Unassigned

Bug Description

In my opinion juju-lint should return different return code if any warning or error was found,
and returning 0 should be only if no issues was found.

An example of misbehavior where I expected to see 1 or a return code other than 0.
```bash
x1:➜ juju-lint git:(1.0.6) ✗ juju-lint -c /snap/juju-lint/current/contrib/fcb-ussuri-focal.yaml -t openstack tests/resources/fcb-yoga-focal-bundle.yaml
2023-05-31 11:30:49 [INFO] juju-lint version 1.0.6 starting...
        * Config directory: /home/rgildein/.config/juju-lint
        * Cloud type: openstack
        * Manual file: tests/resources/fcb-yoga-focal-bundle.yaml
        * Rules file: /snap/juju-lint/current/contrib/fcb-ussuri-focal.yaml
        * Log level: INFO

2023-05-31 11:30:49 [WARNING] Regex autodetection feature of the eq operator is deprecated. It will only check for equality in the future. Please use the search operator for regex checks.
2023-05-31 11:30:49 [INFO] [tests/resources/fcb-yoga-focal-bundle.yaml] Linting manual file...
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application ceph-mon has no config for 'nagios_additional_checks_critical', cannot determine if == True.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application ceph-mon has no config for 'nagios_additional_checks', cannot determine if == '{"ceph_slow_requests": "slow requests"}'.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application ceph-radosgw has no config for 'ceph-osd-replication-count', cannot determine if == 3.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application cinder has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application glance has no config for 'ceph-osd-replication-count', cannot determine if == 3.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application glance has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application keystone has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application neutron-api has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application nova-cloud-controller has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application nova-compute has no config for 'ceph-osd-replication-count', cannot determine if == 3.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application nova-compute has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application ntp has no config for 'auto_peers', cannot determine if == False.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application octavia has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application ovn-central has no config for 'ovsdb-server-election-timer', cannot determine if >= 4.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application placement has no config for 'worker-multiplier', cannot determine if != ''.
2023-05-31 11:30:50 [WARNING] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Application rabbitmq-server has no config for 'queue_thresholds', can't search the regex pattern '\\W\\*, \\W\\*, 25000, 27500'.
2023-05-31 11:30:50 [WARNING] endpoint: elasticsearch not found on filebeat
2023-05-31 11:30:50 [ERROR] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Charm 'ubuntu-advantage' missing on machines: ['0', 'lxd:0', '1', 'lxd:1', '2', 'lxd:2', '3', 'lxd:3', '4', 'lxd:4', '5', 'lxd:5', '6', 'lxd:6', '7', 'lxd:7', '8', 'lxd:8', '9', '10', '11']
2023-05-31 11:30:50 [ERROR] [tests/resources/fcb-yoga-focal-bundle.yaml] [manual/manual] Openstack ops charm 'prometheus-grok-exporter' is missing
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'grafana' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'prometheus' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'prometheus' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'grafana' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'prometheus' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'graylog' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'grafana' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'grafana' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'graylog' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'landscape-server' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'nagios' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'nagios' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'prometheus' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'prometheus' is from another model
2023-05-31 11:30:50 [WARNING] Multi-model is not supported yet. Please check if 'prometheus' is from another model [0.69s]
x1:➜ juju-lint git:(1.0.6) ✗ echo $?
0 [0.01s]
```

Potentially we can use same returns codes as we are using w/ nrpe checks. So 0 - ok, 1 - any warning,
2 - any error and 3 - other?

Eric Chen (eric-chen)
Changed in juju-lint:
importance: Undecided → Medium
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.