Skip to content

Commit

Permalink
Merge branch 'main' into remove-trivyignore
Browse files Browse the repository at this point in the history
  • Loading branch information
arturo-seijas authored Sep 20, 2023
2 parents c378f64 + 3278b92 commit 92a3317
Show file tree
Hide file tree
Showing 6 changed files with 305 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Applicable spec: <link>

### Overview

<!-- A high level overview of the change -->

### Rationale

<!-- The reason the change is needed -->

### Juju Events Changes

<!-- Any changes to the juju events being observed (newly added, significantly modified or deleted) -->

### Module Changes

<!-- Any high level changes to modules and why (Service, Observer, helper) -->

### Library Changes

<!-- Any changes to charm libraries -->

### Checklist

- [ ] The [charm style guide](https://juju.is/docs/sdk/styleguide) was applied
- [ ] The [contributing guide](https://github.com/canonical/is-charms-contributing-guide) was applied
- [ ] The changes are compliant with [ISD054 - Managing Charm Complexity](https://discourse.charmhub.io/t/specification-isd014-managing-charm-complexity/11619)
- [ ] The documentation is generated using `src-docs`
- [ ] The documentation for charmhub is updated
- [ ] The PR is tagged with appropriate label (`urgent`, `trivial`, `complex`)

<!-- Explanation for any unchecked items above -->
6 changes: 6 additions & 0 deletions generate-src-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

lazydocs --no-watermark --output-path src-docs src/*
164 changes: 164 additions & 0 deletions src-docs/charm.py.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<!-- markdownlint-disable -->

<a href="../src/charm.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `charm.py`




**Global Variables**
---------------
- **CONTAINER_PORT**
- **METRICS_PORT**
- **DATABASE_NAME**
- **LICENSE_SECRET_KEY_NAME**
- **REQUIRED_S3_SETTINGS**
- **REQUIRED_SETTINGS**
- **REQUIRED_SSO_SETTINGS**
- **SAML_IDP_CRT**

---

<a href="../src/charm.py#L47"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `check_ranges`

```python
check_ranges(ranges, name)
```

If ranges has one or more invalid elements, return a string describing the problem.

ranges is a string containing a comma-separated list of CIDRs, a CIDR being the only kind of valid element.


---

<a href="../src/charm.py#L63"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `get_container`

```python
get_container(pod_spec, container_name)
```

Find and return the first container in pod_spec whose name is container_name, otherwise return None.


---

<a href="../src/charm.py#L71"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `get_env_config`

```python
get_env_config(pod_spec, container_name)
```

Return the envConfig of the container in pod_spec whose name is container_name, otherwise return None.

If the container exists but has no envConfig, raise KeyError.


---

## <kbd>class</kbd> `MattermostCharmEvents`
Custom charm events.


---

#### <kbd>property</kbd> model

Shortcut for more simple access the model.




---

## <kbd>class</kbd> `MattermostDBMasterAvailableEvent`








---

## <kbd>class</kbd> `MattermostK8sCharm`




<a href="../src/charm.py#L89"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `__init__`

```python
__init__(*args)
```






---

#### <kbd>property</kbd> app

Application that this unit is part of.

---

#### <kbd>property</kbd> charm_dir

Root directory of the charm as it is running.

---

#### <kbd>property</kbd> config

A mapping containing the charm's config and current values.

---

#### <kbd>property</kbd> meta

Metadata of this charm.

---

#### <kbd>property</kbd> model

Shortcut for more simple access the model.

---

#### <kbd>property</kbd> unit

Unit that this execution is responsible for.


---

#### <kbd>handler</kbd> on


---

<a href="../src/charm.py#L338"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `configure_pod`

```python
configure_pod(event)
```

Assemble the pod spec and apply it, if possible.


68 changes: 68 additions & 0 deletions src-docs/environment.py.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- markdownlint-disable -->

<a href="../src/environment.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `environment.py`
Generate container app environment based on charm configuration.

**Global Variables**
---------------
- **CONTAINER_PORT**
- **METRICS_PORT**
- **REQUIRED_S3_SETTINGS**
- **REQUIRED_SETTINGS**
- **REQUIRED_SSO_SETTINGS**
- **SAML_IDP_CRT**
- **CANONICAL_DEFAULTS**

---

<a href="../src/environment.py#L180"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `missing_config_settings`

```python
missing_config_settings(config: dict) → Iterable[str]
```

Return a list of settings required to satisfy configuration dependencies.



**Args:**

- <b>`config`</b>: dict of the charm's configuration



**Returns:**
a list of settings required to satisfy configuration dependencies.


---

<a href="../src/environment.py#L208"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `generate`

```python
generate(config: dict, app_name: str, site_url: str, db_uri: str) → dict
```

Generate container app environment based on charm configuration.



**Args:**

- <b>`config`</b>: dict of the charm's configuration
- <b>`app_name`</b>: name of the app
- <b>`site_url`</b>: public facing URL of mattermost
- <b>`db_uri`</b>: URI of the psql database



**Returns:**
dict of container app environment.


23 changes: 23 additions & 0 deletions src-docs/utils.py.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- markdownlint-disable -->

<a href="../src/utils.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `utils.py`





---

<a href="../src/utils.py#L7"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>function</kbd> `extend_list_merging_dicts_matched_by_key`

```python
extend_list_merging_dicts_matched_by_key(dst, src, key)
```

Merge src, a list of zero or more dictionaries, into dst, also such a list. Dictionaries with the same key will be copied from dst and then merged using .update(src). This is not done recursively.


12 changes: 12 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,15 @@ deps =

[pytest]
asyncio_mode=auto

[testenv:src-docs]
allowlist_externals=sh
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
description = Generate documentation for src
deps =
lazydocs
-r{toxinidir}/requirements.txt
commands =
; can't run lazydocs directly due to needing to run it on src/* which produces an invocation error in tox
sh generate-src-docs.sh

0 comments on commit 92a3317

Please sign in to comment.