Merge ~elmo/juju-lint:master into juju-lint:master

Proposed by James Troup
Status: Merged
Approved by: Xav Paice
Approved revision: 1f91821b2a3d91fa11eefca632caf6dfd4285425
Merged at revision: 70ae62042d302b729477868bfc5a64e93047f3a2
Proposed branch: ~elmo/juju-lint:master
Merge into: juju-lint:master
Diff against target: 107 lines (+21/-13)
2 files modified
contrib/canonical-openstack-rules.yaml (+11/-9)
jujulint.py (+10/-4)
Reviewer Review Type Date Requested Status
Xav Paice (community) Approve
Juju Lint maintainers Pending
Review via email: mp+353534@code.launchpad.net

Commit message

[Xav Paice] Updates to lint rules for recent fcb delivery

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Xav Paice (xavpaice) wrote :

LGTM, tests fine

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 70ae62042d302b729477868bfc5a64e93047f3a2

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/contrib/canonical-openstack-rules.yaml b/contrib/canonical-openstack-rules.yaml
2index 833c229..a5c05cf 100644
3--- a/contrib/canonical-openstack-rules.yaml
4+++ b/contrib/canonical-openstack-rules.yaml
5@@ -1,22 +1,21 @@
6 subordinates:
7 telegraf:
8- where: all
9+ where: all except prometheus # and prometheus-ceph-exporter and prometheus-openstack-exporter
10+ host-suffixes: [prometheus]
11 landscape-client:
12- where: all
13+ where: all except landscape-server
14 filebeat:
15- where: all
16+ where: all except graylog
17 canonical-livepatch:
18 where: host only
19 nrpe:
20- where: container aware
21+ where: container aware # and except nagios
22 host-suffixes: [host, physical]
23 container-suffixes: [lxd, container]
24 ntp:
25 where: host only # You don't want NTP in a container duelling with ntp in the host
26 thruk-agent:
27 where: on nagios
28- prometheus-ceph-exporter:
29- where: on ceph-mon
30
31 operations mandatory: &operations-mandatory-charms
32 - elasticsearch
33@@ -25,8 +24,9 @@ operations mandatory: &operations-mandatory-charms
34 - landscape-server
35 - nagios
36 - openstack-service-checks
37- - prometheus
38+ - prometheus2
39 - prometheus-openstack-exporter
40+ - prometheus-ceph-exporter
41
42 operations mandatory dependencies: &operations-mandatory-deps
43 - postgresql
44@@ -39,7 +39,6 @@ operations subordinates: &operations-mandatory-subs
45 - lldpd
46 - nrpe
47 - ntp
48- - prometheus-ceph-exporter
49 - telegraf
50 - thruk-agent
51
52@@ -54,7 +53,6 @@ openstack mandatory: &openstack-mandatory-charms
53 - ceph-mon
54 - ceph-osd
55 - cinder
56- - cinder-backup
57 - cinder-ceph
58 - glance
59 - heat
60@@ -87,6 +85,10 @@ openstack optional charms: &openstack-optional-charms
61 - neutron-gateway
62 - swift-proxy
63 - swift-storage
64+ - cinder-backup
65+ - vault
66+ - etcd
67+ - easyrsa
68
69 cisco-aci-charms: &cisco-aci-charms
70 - neutron-api-plugin-aci
71diff --git a/jujulint.py b/jujulint.py
72index 05d68b0..81cc53b 100755
73--- a/jujulint.py
74+++ b/jujulint.py
75@@ -15,7 +15,6 @@ import attr
76
77 # TODO:
78 # - tests
79-# - prometheus vs prometheus2
80 # - non-OK statuses?
81 # - missing relations for mandatory subordinates
82 # - info mode, e.g. num of machines, version (e.g. look at ceph), architecture
83@@ -141,14 +140,21 @@ def check_subs(model, lint_rules):
84 for machine in model.subs_on_machines:
85 logging.debug("Checking on %s" % (machine))
86 present_subs = model.subs_on_machines[machine]
87- if where.startswith("on "): # only on specific machines
88+ apps = model.apps_on_machines[machine]
89+ if where.startswith("on "): # only on specific apps
90 logging.debug("requirement is = form...")
91 required_on = where[3:]
92- machine_name = machine.split("/")[0]
93- if machine_name != required_on:
94+ if required_on not in apps:
95 logging.debug("... NOT matched")
96 continue
97 logging.debug("... matched")
98+ # TODO this needs to be not just one app, but a list
99+ elif where.startswith("all except "): # not next to this app
100+ logging.debug("requirement is != form...")
101+ not_on = where[11:]
102+ if not_on in apps:
103+ logging.debug("... matched, not wanted on this host")
104+ continue
105 elif where == "host only":
106 logging.debug("requirement is 'host only' form....")
107 if is_container(machine):

Subscribers

People subscribed via source and target branches