qontract-reconcile 0.10.1rc838__py3-none-any.whl → 0.10.1rc840__py3-none-any.whl
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.
- {qontract_reconcile-0.10.1rc838.dist-info → qontract_reconcile-0.10.1rc840.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc838.dist-info → qontract_reconcile-0.10.1rc840.dist-info}/RECORD +48 -34
- reconcile/gql_definitions/advanced_upgrade_service/aus_clusters.py +1 -0
- reconcile/gql_definitions/advanced_upgrade_service/aus_organization.py +1 -0
- reconcile/gql_definitions/aws_saml_idp/aws_accounts.py +1 -0
- reconcile/gql_definitions/aws_saml_roles/aws_accounts.py +1 -0
- reconcile/gql_definitions/cluster_auth_rhidp/clusters.py +1 -0
- reconcile/gql_definitions/cna/queries/cna_provisioners.py +1 -0
- reconcile/gql_definitions/common/app_code_component_repos.py +4 -0
- reconcile/gql_definitions/common/clusters.py +3 -0
- reconcile/gql_definitions/common/clusters_with_peering.py +1 -0
- reconcile/gql_definitions/common/ocm_environments.py +1 -0
- reconcile/gql_definitions/common/pagerduty_instances.py +2 -0
- reconcile/gql_definitions/common/quay_instances.py +64 -0
- reconcile/gql_definitions/common/slack_workspaces.py +62 -0
- reconcile/gql_definitions/dynatrace_token_provider/dynatrace_bootstrap_tokens.py +6 -0
- reconcile/gql_definitions/fragments/aws_account_common.py +1 -0
- reconcile/gql_definitions/fragments/ocm_environment.py +1 -0
- reconcile/gql_definitions/gitlab_members/gitlab_instances.py +4 -0
- reconcile/gql_definitions/glitchtip/glitchtip_instance.py +2 -0
- reconcile/gql_definitions/jenkins_configs/jenkins_instances.py +79 -0
- reconcile/gql_definitions/jira/jira_servers.py +4 -0
- reconcile/gql_definitions/ocm_labels/clusters.py +1 -0
- reconcile/gql_definitions/openshift_cluster_bots/clusters.py +1 -0
- reconcile/gql_definitions/rhidp/organizations.py +1 -0
- reconcile/gql_definitions/statuspage/statuspages.py +4 -0
- reconcile/gql_definitions/terraform_cloudflare_resources/terraform_cloudflare_accounts.py +2 -0
- reconcile/gql_definitions/terraform_tgw_attachments/aws_accounts.py +1 -0
- reconcile/gql_definitions/unleash_feature_toggles/feature_toggles.py +2 -0
- reconcile/gql_definitions/vault_instances/vault_instances.py +2 -0
- reconcile/test/test_gitlab_members.py +2 -0
- reconcile/test/test_terraform_cloudflare_resources.py +1 -0
- reconcile/typed_queries/cloudflare.py +10 -0
- reconcile/typed_queries/dynatrace.py +10 -0
- reconcile/typed_queries/glitchtip.py +10 -0
- reconcile/typed_queries/jenkins.py +11 -0
- reconcile/typed_queries/jira.py +7 -0
- reconcile/typed_queries/ocm.py +8 -0
- reconcile/typed_queries/quay.py +7 -0
- reconcile/typed_queries/repos.py +19 -6
- reconcile/typed_queries/slack.py +7 -0
- reconcile/typed_queries/unleash.py +10 -0
- reconcile/typed_queries/vault.py +10 -0
- tools/cli_commands/systems_and_tools.py +338 -0
- tools/qontract_cli.py +8 -0
- {qontract_reconcile-0.10.1rc838.dist-info → qontract_reconcile-0.10.1rc840.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc838.dist-info → qontract_reconcile-0.10.1rc840.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc838.dist-info → qontract_reconcile-0.10.1rc840.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,338 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# ruff: noqa: PLC0415 - `import` should be at the top-level of a file
|
3
|
+
|
4
|
+
from typing import (
|
5
|
+
Any,
|
6
|
+
Self,
|
7
|
+
)
|
8
|
+
|
9
|
+
from pydantic import BaseModel
|
10
|
+
|
11
|
+
from reconcile.gql_definitions.common.app_code_component_repos import (
|
12
|
+
AppCodeComponentsV1,
|
13
|
+
)
|
14
|
+
from reconcile.gql_definitions.common.clusters import ClusterV1
|
15
|
+
from reconcile.gql_definitions.common.pagerduty_instances import (
|
16
|
+
PagerDutyInstanceV1,
|
17
|
+
)
|
18
|
+
from reconcile.gql_definitions.common.quay_instances import QuayInstanceV1
|
19
|
+
from reconcile.gql_definitions.common.slack_workspaces import SlackWorkspaceV1
|
20
|
+
from reconcile.gql_definitions.dynatrace_token_provider.dynatrace_bootstrap_tokens import (
|
21
|
+
DynatraceEnvironmentV1,
|
22
|
+
)
|
23
|
+
from reconcile.gql_definitions.fragments.ocm_environment import OCMEnvironment
|
24
|
+
from reconcile.gql_definitions.gitlab_members.gitlab_instances import GitlabInstanceV1
|
25
|
+
from reconcile.gql_definitions.glitchtip.glitchtip_instance import GlitchtipInstanceV1
|
26
|
+
from reconcile.gql_definitions.jenkins_configs.jenkins_instances import (
|
27
|
+
JenkinsInstanceV1,
|
28
|
+
)
|
29
|
+
from reconcile.gql_definitions.jira.jira_servers import JiraServerV1
|
30
|
+
from reconcile.gql_definitions.statuspage.statuspages import StatusPageV1
|
31
|
+
from reconcile.gql_definitions.terraform_cloudflare_resources.terraform_cloudflare_accounts import (
|
32
|
+
CloudflareAccountV1,
|
33
|
+
)
|
34
|
+
from reconcile.gql_definitions.terraform_tgw_attachments.aws_accounts import (
|
35
|
+
AWSAccountV1,
|
36
|
+
)
|
37
|
+
from reconcile.gql_definitions.unleash_feature_toggles.feature_toggles import (
|
38
|
+
UnleashInstanceV1,
|
39
|
+
)
|
40
|
+
from reconcile.gql_definitions.vault_instances.vault_instances import VaultInstanceV1
|
41
|
+
from reconcile.statuspage.integration import get_status_pages
|
42
|
+
from reconcile.typed_queries.cloudflare import get_cloudflare_accounts
|
43
|
+
from reconcile.typed_queries.clusters import get_clusters
|
44
|
+
from reconcile.typed_queries.dynatrace import get_dynatrace_environments
|
45
|
+
from reconcile.typed_queries.gitlab_instances import get_gitlab_instances
|
46
|
+
from reconcile.typed_queries.glitchtip import get_glitchtip_instances
|
47
|
+
from reconcile.typed_queries.jenkins import get_jenkins_instances
|
48
|
+
from reconcile.typed_queries.jira import get_jira_servers
|
49
|
+
from reconcile.typed_queries.ocm import get_ocm_environments
|
50
|
+
from reconcile.typed_queries.pagerduty_instances import get_pagerduty_instances
|
51
|
+
from reconcile.typed_queries.quay import get_quay_instances
|
52
|
+
from reconcile.typed_queries.repos import get_code_components
|
53
|
+
from reconcile.typed_queries.slack import get_slack_workspaces
|
54
|
+
from reconcile.typed_queries.terraform_tgw_attachments.aws_accounts import (
|
55
|
+
get_aws_accounts,
|
56
|
+
)
|
57
|
+
from reconcile.typed_queries.unleash import get_unleash_instances
|
58
|
+
from reconcile.typed_queries.vault import get_vault_instances
|
59
|
+
from reconcile.utils import (
|
60
|
+
gql,
|
61
|
+
)
|
62
|
+
|
63
|
+
|
64
|
+
class SystemTool(BaseModel):
|
65
|
+
system_type: str
|
66
|
+
system_id: str
|
67
|
+
name: str
|
68
|
+
url: str
|
69
|
+
description: str
|
70
|
+
|
71
|
+
@classmethod
|
72
|
+
def init_from_model(cls, model: Any) -> Self:
|
73
|
+
match model:
|
74
|
+
case GitlabInstanceV1():
|
75
|
+
return cls.init_from_gitlab(model)
|
76
|
+
case JenkinsInstanceV1():
|
77
|
+
return cls.init_from_jenkins(model)
|
78
|
+
case ClusterV1():
|
79
|
+
return cls.init_from_cluster(model)
|
80
|
+
case AWSAccountV1():
|
81
|
+
return cls.init_from_aws_account(model)
|
82
|
+
case DynatraceEnvironmentV1():
|
83
|
+
return cls.init_from_dynatrace_environment(model)
|
84
|
+
case GlitchtipInstanceV1():
|
85
|
+
return cls.init_from_glitchtip_instance(model)
|
86
|
+
case JiraServerV1():
|
87
|
+
return cls.init_from_jira_server(model)
|
88
|
+
case OCMEnvironment():
|
89
|
+
return cls.init_from_ocm_environment(model)
|
90
|
+
case PagerDutyInstanceV1():
|
91
|
+
return cls.init_from_pagerduty_instance(model)
|
92
|
+
case QuayInstanceV1():
|
93
|
+
return cls.init_from_quay_instance(model)
|
94
|
+
case SlackWorkspaceV1():
|
95
|
+
return cls.init_from_slack_workspace(model)
|
96
|
+
case StatusPageV1():
|
97
|
+
return cls.init_from_status_page(model)
|
98
|
+
case UnleashInstanceV1():
|
99
|
+
return cls.init_from_unleash_instance(model)
|
100
|
+
case VaultInstanceV1():
|
101
|
+
return cls.init_from_vault_instance(model)
|
102
|
+
case CloudflareAccountV1():
|
103
|
+
return cls.init_from_cloudflare_account(model)
|
104
|
+
case AppCodeComponentsV1():
|
105
|
+
return cls.init_from_code_component(model)
|
106
|
+
case _:
|
107
|
+
raise NotImplementedError(f"unsupported: {model}")
|
108
|
+
|
109
|
+
@classmethod
|
110
|
+
def init_from_gitlab(cls, g: GitlabInstanceV1) -> Self:
|
111
|
+
return cls(
|
112
|
+
system_type="gitlab",
|
113
|
+
system_id=g.name,
|
114
|
+
name=g.name,
|
115
|
+
url=g.url,
|
116
|
+
description=g.description,
|
117
|
+
)
|
118
|
+
|
119
|
+
@classmethod
|
120
|
+
def init_from_jenkins(cls, j: JenkinsInstanceV1) -> Self:
|
121
|
+
return cls(
|
122
|
+
system_type="jenkins",
|
123
|
+
system_id=j.name,
|
124
|
+
name=j.name,
|
125
|
+
url=j.server_url,
|
126
|
+
description=j.description,
|
127
|
+
)
|
128
|
+
|
129
|
+
@classmethod
|
130
|
+
def init_from_cluster(cls, c: ClusterV1) -> Self:
|
131
|
+
return cls(
|
132
|
+
system_type="openshift",
|
133
|
+
system_id=c.spec.q_id if c.spec else "",
|
134
|
+
name=c.name,
|
135
|
+
url=c.server_url,
|
136
|
+
description=c.description,
|
137
|
+
)
|
138
|
+
|
139
|
+
@classmethod
|
140
|
+
def init_from_aws_account(cls, a: AWSAccountV1) -> Self:
|
141
|
+
return cls(
|
142
|
+
system_type="aws",
|
143
|
+
system_id=a.uid,
|
144
|
+
name=a.name,
|
145
|
+
url=a.console_url,
|
146
|
+
description=a.description,
|
147
|
+
)
|
148
|
+
|
149
|
+
@classmethod
|
150
|
+
def init_from_dynatrace_environment(cls, dt: DynatraceEnvironmentV1) -> Self:
|
151
|
+
return cls(
|
152
|
+
system_type="dynatrace",
|
153
|
+
system_id=dt.environment_id,
|
154
|
+
name=dt.name,
|
155
|
+
url=dt.environment_url,
|
156
|
+
description=dt.description,
|
157
|
+
)
|
158
|
+
|
159
|
+
@classmethod
|
160
|
+
def init_from_glitchtip_instance(cls, g: GlitchtipInstanceV1) -> Self:
|
161
|
+
return cls(
|
162
|
+
system_type="glitchtip",
|
163
|
+
system_id=g.name,
|
164
|
+
name=g.name,
|
165
|
+
url=g.console_url,
|
166
|
+
description=g.description,
|
167
|
+
)
|
168
|
+
|
169
|
+
@classmethod
|
170
|
+
def init_from_jira_server(cls, j: JiraServerV1) -> Self:
|
171
|
+
return cls(
|
172
|
+
system_type="jira",
|
173
|
+
system_id=j.name,
|
174
|
+
name=j.name,
|
175
|
+
url=j.server_url,
|
176
|
+
description=j.description,
|
177
|
+
)
|
178
|
+
|
179
|
+
@classmethod
|
180
|
+
def init_from_ocm_environment(cls, o: OCMEnvironment) -> Self:
|
181
|
+
return cls(
|
182
|
+
system_type="ocm",
|
183
|
+
system_id=o.name,
|
184
|
+
name=o.name,
|
185
|
+
url=o.url,
|
186
|
+
description=o.description,
|
187
|
+
)
|
188
|
+
|
189
|
+
@classmethod
|
190
|
+
def init_from_pagerduty_instance(cls, p: PagerDutyInstanceV1) -> Self:
|
191
|
+
return cls(
|
192
|
+
system_type="pagerduty",
|
193
|
+
system_id=p.name,
|
194
|
+
name=p.name,
|
195
|
+
url=p.description, # no url
|
196
|
+
description=p.description,
|
197
|
+
)
|
198
|
+
|
199
|
+
@classmethod
|
200
|
+
def init_from_quay_instance(cls, q: QuayInstanceV1) -> Self:
|
201
|
+
return cls(
|
202
|
+
system_type="quay",
|
203
|
+
system_id=q.name,
|
204
|
+
name=q.name,
|
205
|
+
url=f"https://{q.name}.pagerduty.com",
|
206
|
+
description=q.description,
|
207
|
+
)
|
208
|
+
|
209
|
+
@classmethod
|
210
|
+
def init_from_slack_workspace(cls, s: SlackWorkspaceV1) -> Self:
|
211
|
+
return cls(
|
212
|
+
system_type="slack",
|
213
|
+
system_id=s.name,
|
214
|
+
name=s.name,
|
215
|
+
url=f"https://{s.name}.slack.com",
|
216
|
+
description=s.description,
|
217
|
+
)
|
218
|
+
|
219
|
+
@classmethod
|
220
|
+
def init_from_status_page(cls, s: StatusPageV1) -> Self:
|
221
|
+
return cls(
|
222
|
+
system_type="statuspage",
|
223
|
+
system_id=s.name,
|
224
|
+
name=s.name,
|
225
|
+
url=s.url,
|
226
|
+
description=s.description,
|
227
|
+
)
|
228
|
+
|
229
|
+
@classmethod
|
230
|
+
def init_from_unleash_instance(cls, u: UnleashInstanceV1) -> Self:
|
231
|
+
return cls(
|
232
|
+
system_type="unleash",
|
233
|
+
system_id=u.name,
|
234
|
+
name=u.name,
|
235
|
+
url=u.url,
|
236
|
+
description=u.description,
|
237
|
+
)
|
238
|
+
|
239
|
+
@classmethod
|
240
|
+
def init_from_vault_instance(cls, v: VaultInstanceV1) -> Self:
|
241
|
+
return cls(
|
242
|
+
system_type="vault",
|
243
|
+
system_id=v.name,
|
244
|
+
name=v.name,
|
245
|
+
url=v.address,
|
246
|
+
description=v.description,
|
247
|
+
)
|
248
|
+
|
249
|
+
@classmethod
|
250
|
+
def init_from_cloudflare_account(cls, a: CloudflareAccountV1) -> Self:
|
251
|
+
return cls(
|
252
|
+
system_type="cloudflare",
|
253
|
+
system_id=a.name,
|
254
|
+
name=a.name,
|
255
|
+
url="https://dash.cloudflare.com/",
|
256
|
+
description=a.description,
|
257
|
+
)
|
258
|
+
|
259
|
+
@classmethod
|
260
|
+
def init_from_code_component(cls, c: AppCodeComponentsV1) -> Self:
|
261
|
+
return cls(
|
262
|
+
system_type=c.resource,
|
263
|
+
system_id=c.name,
|
264
|
+
name=c.name,
|
265
|
+
url=c.url,
|
266
|
+
description=c.name,
|
267
|
+
)
|
268
|
+
|
269
|
+
|
270
|
+
class SystemToolInventory:
|
271
|
+
def __init__(self) -> None:
|
272
|
+
self.systems_and_tools: list[SystemTool] = []
|
273
|
+
|
274
|
+
def append(self, model: Any) -> None:
|
275
|
+
self.systems_and_tools.append(SystemTool.init_from_model(model))
|
276
|
+
|
277
|
+
def update(self, models: list[Any]) -> None:
|
278
|
+
for m in models:
|
279
|
+
self.append(m)
|
280
|
+
|
281
|
+
@property
|
282
|
+
def data(self) -> list[dict[str, Any]]:
|
283
|
+
return [
|
284
|
+
{
|
285
|
+
"type": st.system_type,
|
286
|
+
"id": st.system_id,
|
287
|
+
"name": st.name,
|
288
|
+
"url": st.url,
|
289
|
+
"description": st.description.replace("\n", "\\n"),
|
290
|
+
}
|
291
|
+
for st in self.systems_and_tools
|
292
|
+
]
|
293
|
+
|
294
|
+
@property
|
295
|
+
def columns(self) -> list[str]:
|
296
|
+
return [
|
297
|
+
"type",
|
298
|
+
"id",
|
299
|
+
"name",
|
300
|
+
"url",
|
301
|
+
"description",
|
302
|
+
]
|
303
|
+
|
304
|
+
|
305
|
+
def get_systems_and_tools_inventory() -> SystemToolInventory:
|
306
|
+
gql_api = gql.get_api()
|
307
|
+
inventory = SystemToolInventory()
|
308
|
+
|
309
|
+
inventory.update(get_gitlab_instances())
|
310
|
+
inventory.update(get_jenkins_instances())
|
311
|
+
inventory.update(get_clusters())
|
312
|
+
inventory.update(get_aws_accounts(gql_api))
|
313
|
+
inventory.update(get_dynatrace_environments())
|
314
|
+
inventory.update(get_glitchtip_instances())
|
315
|
+
inventory.update(get_jira_servers())
|
316
|
+
inventory.update(get_ocm_environments())
|
317
|
+
inventory.update(get_pagerduty_instances(gql_api.query))
|
318
|
+
inventory.update(get_quay_instances())
|
319
|
+
inventory.update(get_slack_workspaces())
|
320
|
+
inventory.update(get_status_pages())
|
321
|
+
inventory.update(get_unleash_instances())
|
322
|
+
inventory.update(get_vault_instances())
|
323
|
+
inventory.update(get_cloudflare_accounts())
|
324
|
+
inventory.update([
|
325
|
+
c for c in get_code_components() if c.resource == "app-interface"
|
326
|
+
])
|
327
|
+
|
328
|
+
inventory.systems_and_tools.append(
|
329
|
+
SystemTool(
|
330
|
+
system_type="github",
|
331
|
+
system_id="github",
|
332
|
+
name="github",
|
333
|
+
url="https://github.com",
|
334
|
+
description="github",
|
335
|
+
)
|
336
|
+
)
|
337
|
+
|
338
|
+
return inventory
|
tools/qontract_cli.py
CHANGED
@@ -142,6 +142,7 @@ from tools.cli_commands.gpg_encrypt import (
|
|
142
142
|
GPGEncryptCommand,
|
143
143
|
GPGEncryptCommandData,
|
144
144
|
)
|
145
|
+
from tools.cli_commands.systems_and_tools import get_systems_and_tools_inventory
|
145
146
|
from tools.sre_checkpoints import (
|
146
147
|
full_name,
|
147
148
|
get_latest_sre_checkpoints,
|
@@ -2697,6 +2698,13 @@ def hcp_migration_status(ctx):
|
|
2697
2698
|
print_output(ctx.obj["options"], data, columns)
|
2698
2699
|
|
2699
2700
|
|
2701
|
+
@get.command()
|
2702
|
+
@click.pass_context
|
2703
|
+
def systems_and_tools(ctx):
|
2704
|
+
inventory = get_systems_and_tools_inventory()
|
2705
|
+
print_output(ctx.obj["options"], inventory.data, inventory.columns)
|
2706
|
+
|
2707
|
+
|
2700
2708
|
@root.group(name="set")
|
2701
2709
|
@output
|
2702
2710
|
@click.pass_context
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc838.dist-info → qontract_reconcile-0.10.1rc840.dist-info}/top_level.txt
RENAMED
File without changes
|