Skip to content

Commit

Permalink
Adapt to paas-app-charmer 1.0.4 (#35)
Browse files Browse the repository at this point in the history
* Use S3 and SAML from paas-app-charmer 1.0.3
* test agains paas-app-charmer@main
* Use url parts from env variables. Remove aws-endpoint-url, as it is fixed upstream
* Pin to paas-app-charmer 1.0.4
  • Loading branch information
javierdelapuente authored Jul 30, 2024
1 parent 08347c8 commit b1601ef
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 550 deletions.
9 changes: 1 addition & 8 deletions charm/charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ requires:
postgresql:
interface: postgresql_client
limit: 1
storage:
s3:
interface: s3
limit: 1
redis:
Expand All @@ -65,10 +65,3 @@ config:
description: |-
SAML attribute used for the email.
type: string
aws-endpoint-url:
description: |-
Environment variable for AWS_ENDPOINT_URL.
This variable has to be set to the S3 compatible server that will host
data sources if they are not hosted in Amazon S3.
See https://github.com/netbox-community/netbox/issues/15427
type: string
6 changes: 0 additions & 6 deletions charm/docs/how-to/configure-scripts-reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ To use scripts and reports, it is necessary to configure a Data Source, which ca
"Git" or "Amazon S3". The git repository https://github.com/netbox-community/customizations.git is
a good source of examples of both scripts and reports.

For S3 data sources, if the S3 server used is S3 compatible, the juju configuration
option `aws-endpoint-url` should be set to the url of the S3 server, as NetBox by default only
allows using Amazon S3. This option limits the S3 compatible servers to just one possible
S3 server. For example, if you use minio in the url `https://minio.example.com`, you
should run `juju config netbox aws-endpoint-url=https://minio.example.com`.

Once a data source for "Git" or "Amazon S3" is configured (menu Operations -> Data Sources),
it should be synced (blue button in the top right of the data source screen).

Expand Down
2 changes: 1 addition & 1 deletion charm/docs/how-to/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The following commands import the images in the Docker daemon and push them into
the registry:

cd [project_dir] && rockcraft pack
skopeo --insecure-policy copy --dest-tls-verify=false oci-archive:netbox_0.1_amd64.rock docker://localhost:32000/netbox:latest
rockcraft.skopeo --insecure-policy copy --dest-tls-verify=false oci-archive:netbox_0.1_amd64.rock docker://localhost:32000/netbox:latest

### Deploy

Expand Down
2 changes: 1 addition & 1 deletion charm/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
paas-app-charmer==1.0.2
paas-app-charmer==1.0.4
143 changes: 3 additions & 140 deletions charm/src-docs/charm.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Django Charm entrypoint.
## <kbd>class</kbd> `DjangoCharm`
Django Charm service.

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

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

Expand Down Expand Up @@ -73,41 +73,7 @@ Unit that this execution is responsible for.

---

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

### <kbd>function</kbd> `gen_extra_env`

```python
gen_extra_env() → dict[str, str]
```

Return the environment variables for django scripts.



**Returns:**
dict with environment variables.

---

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

### <kbd>function</kbd> `is_ready`

```python
is_ready() → bool
```

Check if the charm is ready to start the workload application.



**Returns:**
True if the charm is ready to start the workload application.

---

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

### <kbd>function</kbd> `restart`

Expand All @@ -119,43 +85,7 @@ Restart all services.

---

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

### <kbd>function</kbd> `s3_env`

```python
s3_env() → dict[str, str]
```

Environment variables for S3 for storage.

This should disappear/get updated once paas-app-charmer project supports the S3 integration.



**Returns:**
dict with environment variables.

---

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

### <kbd>function</kbd> `saml_env`

```python
saml_env() → dict[str, str]
```

Environment variables for SAML.



**Returns:**
dict with environment variables.

---

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

### <kbd>function</kbd> `workload`

Expand All @@ -173,70 +103,3 @@ Delete this function when it is in the paas-app-charmer project.
Workload Container


---

## <kbd>class</kbd> `S3Parameters`
Configuration for accessing S3 bucket.



**Attributes:**

- <b>`access_key`</b>: AWS access key.
- <b>`secret_key`</b>: AWS secret key.
- <b>`region`</b>: The region to connect to the object storage.
- <b>`bucket`</b>: The bucket name.
- <b>`endpoint`</b>: The endpoint used to connect to the object storage.
- <b>`path`</b>: The path inside the bucket to store objects.
- <b>`s3_uri_style`</b>: The S3 protocol specific bucket path lookup type. Can be "path" or "host".
- <b>`addressing_style`</b>: S3 protocol addressing style, can be "path" or "virtual".


---

#### <kbd>property</kbd> addressing_style

Translates s3_uri_style to AWS addressing_style.

---

#### <kbd>property</kbd> model_extra

Get extra fields set during validation.



**Returns:**
A dictionary of extra fields, or `None` if `config.extra` is not set to `"allow"`.

---

#### <kbd>property</kbd> model_fields_set

Returns the set of fields that have been explicitly set on this model instance.



**Returns:**
A set of strings representing the fields that have been set, i.e. that were not filled from defaults.



---

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

### <kbd>function</kbd> `to_env`

```python
to_env() → dict[str, str]
```

Convert to env variables.



**Returns:**
dict with environment variables for django storage.


Loading

0 comments on commit b1601ef

Please sign in to comment.