Merge ~valexby/juju-lint:jammy-yoga-cos into juju-lint:master

Proposed by Giuseppe Petralia
Status: Needs review
Proposed branch: ~valexby/juju-lint:jammy-yoga-cos
Merge into: juju-lint:master
Diff against target: 259 lines (+163/-11)
8 files modified
contrib/fcb-yoga-jammy-cos.yaml (+10/-0)
contrib/fcb-yoga-jammy.yaml (+1/-0)
contrib/includes/aggregator-openstack-cos.yaml (+34/-0)
contrib/includes/aggregator-openstack.yaml (+3/-0)
contrib/includes/base.yaml (+1/-1)
contrib/includes/operations-cos.yaml (+85/-0)
contrib/includes/saas.yaml (+1/-1)
jujulint/model_input.py (+28/-9)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack continuous-integration Needs Fixing
BootStack Reviewers Pending
Review via email: mp+455428@code.launchpad.net
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
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Unable to determine commit message from repository - please click "Set commit message" and enter the commit message manually.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

FAILED: Continuous integration, rev:02626ced15de24a61236b5a00e3441be4985ca5e

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~valexby/juju-lint/+git/juju-lint/+merge/455428/+edit-commit-message

https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/20/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/bootstack/job/lp-charm-test-functest31/525/
    None: https://jenkins.canonical.com/bootstack/job/lp-update-mp/762/

Click here to trigger a rebuild:
https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/20//rebuild

review: Needs Fixing (continuous-integration)
~valexby/juju-lint:jammy-yoga-cos updated
453f34b... by Aliaksandr Vasiuk

Add cos-proxy and grafana-agent relations rules

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

FAILED: Continuous integration, rev:453f34bf2bcaf8892dfbbcc22d8134af53fa6327

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~valexby/juju-lint/+git/juju-lint/+merge/455428/+edit-commit-message

https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/21/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/bootstack/job/lp-charm-test-functest31/526/
    None: https://jenkins.canonical.com/bootstack/job/lp-update-mp/763/

Click here to trigger a rebuild:
https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/21//rebuild

review: Needs Fixing (continuous-integration)
~valexby/juju-lint:jammy-yoga-cos updated
e4386ca... by Aliaksandr Vasiuk

Configure cos CMRs

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

FAILED: Continuous integration, rev:46d0e83405de0a7f0db67b332d844fe229cd3b9a

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~valexby/juju-lint/+git/juju-lint/+merge/455428/+edit-commit-message

https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/23/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/bootstack/job/lp-charm-test-functest31/528/
    None: https://jenkins.canonical.com/bootstack/job/lp-update-mp/765/

Click here to trigger a rebuild:
https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/23//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

FAILED: Continuous integration, rev:b0172f45f9df9cb6a73207fd933e2cf051c16a95

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~valexby/juju-lint/+git/juju-lint/+merge/455428/+edit-commit-message

https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/24/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/bootstack/job/lp-charm-test-functest31/529/
    None: https://jenkins.canonical.com/bootstack/job/lp-update-mp/766/

Click here to trigger a rebuild:
https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/24//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

FAILED: Continuous integration, rev:4a81159796366dbf40f2fb179196051ac062d6f8

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~valexby/juju-lint/+git/juju-lint/+merge/455428/+edit-commit-message

https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/25/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/bootstack/job/lp-charm-test-functest31/530/
    None: https://jenkins.canonical.com/bootstack/job/lp-update-mp/767/

Click here to trigger a rebuild:
https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/25//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

FAILED: Continuous integration, rev:e4386ca4e7d9a10de4b5d7fc5cc42611c70639b5

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~valexby/juju-lint/+git/juju-lint/+merge/455428/+edit-commit-message

https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/26/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/bootstack/job/lp-charm-test-functest31/531/
    None: https://jenkins.canonical.com/bootstack/job/lp-update-mp/768/

Click here to trigger a rebuild:
https://jenkins.canonical.com/bootstack/job/lp-juju-lint-ci/26//rebuild

review: Needs Fixing (continuous-integration)

Unmerged commits

e4386ca... by Aliaksandr Vasiuk

Configure cos CMRs

453f34b... by Aliaksandr Vasiuk

Add cos-proxy and grafana-agent relations rules

0c3ab88... by Aliaksandr Vasiuk

Configure hw-observer for all metals

b4efe8c... by Aliaksandr Vasiuk

Fixed 'cos charms' to 'operations mandatory'

9094150... by Giuseppe Petralia

Add cos-proxy relations check

8fa0112... by Giuseppe Petralia

Initial structure for validating jammy yoga cos

cce09ac... by Giuseppe Petralia

Check relations by charm name and not application

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/contrib/fcb-yoga-jammy-cos.yaml b/contrib/fcb-yoga-jammy-cos.yaml
2new file mode 100644
3index 0000000..33c9f51
4--- /dev/null
5+++ b/contrib/fcb-yoga-jammy-cos.yaml
6@@ -0,0 +1,10 @@
7+!include includes/base.yaml
8+!include includes/networking/ovn.yaml
9+!include includes/database/mysql.yaml
10+!include includes/release/yoga.yaml
11+!include includes/series/jammy.yaml
12+!include includes/openstack.yaml
13+!include includes/operations.yaml
14+!include includes/saas.yaml
15+!include includes/operations-cos.yaml
16+!include includes/aggregator-openstack-cos.yaml
17diff --git a/contrib/fcb-yoga-jammy.yaml b/contrib/fcb-yoga-jammy.yaml
18index bedfc36..80e7a89 100644
19--- a/contrib/fcb-yoga-jammy.yaml
20+++ b/contrib/fcb-yoga-jammy.yaml
21@@ -6,4 +6,5 @@
22 !include includes/openstack.yaml
23 !include includes/operations.yaml
24 !include includes/saas.yaml
25+!include includes/openstack-cos.yaml
26 !include includes/aggregator-openstack.yaml
27diff --git a/contrib/includes/aggregator-openstack-cos.yaml b/contrib/includes/aggregator-openstack-cos.yaml
28new file mode 100644
29index 0000000..e1a1241
30--- /dev/null
31+++ b/contrib/includes/aggregator-openstack-cos.yaml
32@@ -0,0 +1,34 @@
33+operations charms: &operations-charms
34+ - *operations-mandatory-charms
35+ - *operations-mandatory-deps
36+ - *operations-mandatory-subs
37+ - *operations-optional-charms
38+ - *operations-optional-subs
39+ - *operations-openstack-mandatory-charms
40+ - *operations-openstack-mandatory-release
41+ - *operations-cos-mandatory-charms
42+
43+openstack charms: &openstack-charms
44+ - *openstack-mandatory-charms
45+ - *openstack-mandatory-deps
46+ - *openstack-mandatory-subs
47+ - *openstack-optional-charms
48+ - *openstack-loadbalancer
49+ - *cisco-aci-charms
50+ - *trilio-charms
51+
52+known charms:
53+ - ubuntu
54+ - *openstack-charms
55+ - *operations-charms
56+
57+relations:
58+ - *relations-base-check
59+ - *relations-cos-check
60+
61+subordinates:
62+ << : [ *subordinates-base-check, *subordinates-cos-check ]
63+
64+saas:
65+ - *saas-base
66+ - *saas-cos
67diff --git a/contrib/includes/aggregator-openstack.yaml b/contrib/includes/aggregator-openstack.yaml
68index d8c1305..591bc99 100644
69--- a/contrib/includes/aggregator-openstack.yaml
70+++ b/contrib/includes/aggregator-openstack.yaml
71@@ -23,3 +23,6 @@ known charms:
72
73 relations:
74 - *relations-base-check
75+
76+subordinates:
77+ << : [ *subordinates-base-check ]
78diff --git a/contrib/includes/base.yaml b/contrib/includes/base.yaml
79index fc095c4..b8482af 100644
80--- a/contrib/includes/base.yaml
81+++ b/contrib/includes/base.yaml
82@@ -18,7 +18,7 @@ config:
83 disable-unattended-upgrades:
84 eq: true
85
86-subordinates:
87+subordinates base check: &subordinates-base-check
88 telegraf:
89 where: all except prometheus
90 # and prometheus-ceph-exporter and prometheus-openstack-exporter
91diff --git a/contrib/includes/operations-cos.yaml b/contrib/includes/operations-cos.yaml
92new file mode 100644
93index 0000000..e650bb8
94--- /dev/null
95+++ b/contrib/includes/operations-cos.yaml
96@@ -0,0 +1,85 @@
97+saas cos: &saas-cos
98+ - cos-scrape-interval-config
99+ - cos-grafana
100+ - cos-prometheus-scrape
101+ - cos-loki
102+ - cos-prometheus
103+
104+operations cos mandatory: &operations-cos-mandatory-charms
105+ - grafana-agent
106+ - cos-proxy
107+ - hardware-observer
108+ - *saas-cos
109+
110+operations mandatory:
111+ - *operations-cos-mandatory-charms
112+ - *operations-mandatory-charms
113+
114+relations cos check: &relations-cos-check
115+ - charm: grafana-agent
116+ ubiquitous: true
117+ - charm: cos-proxy
118+ check: [
119+ ["nrpe:monitors", "cos-proxy:monitors"]
120+ ]
121+ - charm: cos-proxy
122+ check: [
123+ ["ceph-mon:prometheus", "cos-proxy:prometheus-target"]
124+ ]
125+ - charm: cos-proxy
126+ check: [
127+ ["prometheus-grok-exporter:prometheus-client", "cos-proxy:prometheus-target"]
128+ ]
129+ - charm: cos-proxy
130+ check: [
131+ ["prometheus-openstack-exporter:prometheus-openstack-exporter-service", "cos-proxy:prometheus-target"]
132+ ]
133+ - charm: cos-proxy
134+ check: [
135+ ["telegraf:prometheus-client", "cos-proxy:prometheus-target"]
136+ ]
137+ - charm: cos-proxy
138+ check: [
139+ ["prometheus-libvirt-exporter:scrape", "cos-proxy:prometheus-target"]
140+ ]
141+ - charm: cos-proxy
142+ check: [
143+ ["etcd:prometheus", "cos-proxy:prometheus-target"]
144+ ]
145+ - charm: cos-proxy
146+ check: [
147+ ["cos-proxy:downstream-grafana-dashboard", "cos-grafana:grafana-dashboard"]
148+ ]
149+ - charm: cos-proxy
150+ check: [
151+ ["cos-proxy:downstream-prometheus-scrape", "cos-prometheus-scrape:metrics-endpoint"]
152+ ]
153+ - charm: cos-proxy
154+ check: [
155+ ["cos-proxy:downstream-prometheus-scrape", "cos-scrape-interval-config:configurable-scrape-jobs"]
156+ ]
157+ - charm: hardware-observer
158+ check: [
159+ ["hardware-observer:cos-agent", "grafana-agent:cos-agent"]
160+ ]
161+ - charm: cos-grafana
162+ check: [
163+ ["grafana-agent:grafana-dashboards-provider", "cos-grafana:grafana-dashboard"]
164+ ]
165+ - charm: cos-loki
166+ check: [
167+ ["cos-loki:logging", "grafana-agent:logging-consumer"]
168+ ]
169+ - charm: cos-prometheus
170+ check: [
171+ ["cos-prometheus:receive-remote-write", "grafana-agent:send-remote-write"]
172+ ]
173+
174+
175+subordinates cos check: &subordinates-cos-check
176+ grafana-agent:
177+ where: container aware
178+ host-suffixes: [host, physical, guest]
179+ container-suffixes: [lxd, container]
180+ hardware-observer:
181+ where: metal only
182diff --git a/contrib/includes/saas.yaml b/contrib/includes/saas.yaml
183index bac2ea5..6458b67 100644
184--- a/contrib/includes/saas.yaml
185+++ b/contrib/includes/saas.yaml
186@@ -1,4 +1,4 @@
187-saas:
188+saas: &saas-base
189 - elasticsearch
190 - grafana
191 - graylog
192diff --git a/jujulint/model_input.py b/jujulint/model_input.py
193index 8233ebb..c5b221d 100644
194--- a/jujulint/model_input.py
195+++ b/jujulint/model_input.py
196@@ -36,6 +36,13 @@ class BaseFile:
197 """Applications present in the file."""
198 return set(self.applications_data.keys())
199
200+ @property
201+ def charm_names(self) -> Set:
202+ """Applications present in the file."""
203+ return set(
204+ self.applications_data[app]["charm"] for app in self.applications_data
205+ )
206+
207 @staticmethod
208 def split_relation(relation: List[List[str]]) -> Tuple[str, str]:
209 """Split relations into apps and endpoints.
210@@ -78,16 +85,18 @@ class BaseFile:
211 # app == "*" means all apps
212 # a charm from relation rule can have different app names.
213 if app != "*" and app != charm:
214- if app not in self.applications:
215+ if app not in self.charm_names:
216 LOGGER.warning(f"{app} not found on applications.")
217 return "", ""
218
219 # NOTE(gabrielcocenza) it's not always that a bundle will contain all endpoints under "bindings".
220 # See LP#1949883 and LP#1990017
221 # juju-info is represented by "" on endpoint-bindings
222- if endpoint != "juju-info" and endpoint not in self.applications_data[
223- app
224- ].get(endpoints_key, {}):
225+ if (
226+ endpoint != "juju-info"
227+ and app in self.applications_data
228+ and endpoint not in self.applications_data[app].get(endpoints_key, {})
229+ ):
230 LOGGER.warning(f"endpoint: {endpoint} not found on {app}")
231 return "", ""
232 return app, endpoint
233@@ -119,11 +128,21 @@ class BaseFile:
234 if endpoint
235 in self.applications_data.get(app, {}).get(endpoints_key, {})
236 }
237- return (
238- set([app])
239- if endpoint in self.applications_data.get(app, {}).get(endpoints_key, {})
240- else set()
241- )
242+
243+ endpoints = {}
244+ for application in self.applications_data:
245+ if self.applications_data[application].get("charm") == app:
246+ endpoints[application] = list(
247+ self.applications_data[application].get(endpoints_key, {}).keys()
248+ )
249+
250+ result = set()
251+
252+ for charm in endpoints:
253+ if endpoint in endpoints[charm]:
254+ result.add(charm)
255+
256+ return result
257
258 def filter_machines_by_charm(self, charm: str) -> Set:
259 """Filter machines that has a specific charm.

Subscribers

People subscribed via source and target branches