Skip to content

Commit

Permalink
Ubuntu Jammy support. (#96)
Browse files Browse the repository at this point in the history
* Ubuntu Jammy support.

* Add build instructions to README.md
  • Loading branch information
mkalcok authored Aug 19, 2022
1 parent 8ad133e commit 564f6e5
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ To monitor additional applications, simply relate the filebeat subordinate:

juju add-relation filebeat:beats-host my-charm

## Build and publish new versions

This charm uses the reactive framework. `charm pack` is used to build a
deployable charm. In order to publish new versions of the charm, the following
commands need to be run:

**Note:** Use appropriate revision number in `charmcraft release` command.

```
charmcraft pack
charmcraft upload filebeat_ubuntu-22.04-amd64_ubuntu-20.04-amd64_ubuntu-18.04-amd64.charm
charmcraft release filebeat --revision=34 --channel=edge
charmcraft status filebeat
```

## Contact Information

- <[email protected]>
Expand Down
32 changes: 32 additions & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Learn more about charmcraft.yaml configuration at:
# https://juju.is/docs/sdk/charmcraft-config
# This is a template `charmcraft.yaml` file for reactive charms
# This file is managed by bootstack-charms-spec and should not be modified
# within individual charm repos. https://launchpad.net/bootstack-charms-spec

type: charm

parts:
charm:
source: ./
plugin: reactive
build-snaps: [ charm ]

bases:
- build-on:
- name: ubuntu
channel: "20.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "22.04"
architectures:
- amd64
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- name: ubuntu
channel: "18.04"
architectures:
- amd64
13 changes: 6 additions & 7 deletions reactive/filebeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from charms.reactive import remove_state
from charms.reactive import hook
from charms.reactive.helpers import data_changed
from charms.templating.jinja2 import render

from charmhelpers.core import unitdata
from charmhelpers.core.hookenv import config, log
Expand Down Expand Up @@ -108,13 +107,13 @@ def manage_filebeat_logstash_ssl():
key = base64.b64decode(logstash_ssl_key).decode('utf8')

if data_changed('logstash_cert', cert):
render(template='{{ data }}',
context={'data': cert},
target=LOGSTASH_SSL_CERT, perms=0o444)
with open(LOGSTASH_SSL_CERT, "w") as cert_file:
cert_file.write(cert)
os.chmod(LOGSTASH_SSL_CERT, 0o444)
if data_changed('logstash_key', key):
render(template='{{ data }}',
context={'data': key},
target=LOGSTASH_SSL_KEY, perms=0o400)
with open(LOGSTASH_SSL_KEY, "w") as key_file:
key_file.write(key)
os.chmod(LOGSTASH_SSL_KEY, 0o400)
else:
if not logstash_ssl_cert and os.path.exists(LOGSTASH_SSL_CERT):
os.remove(LOGSTASH_SSL_CERT)
Expand Down
6 changes: 6 additions & 0 deletions templates/filebeat-6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,9 @@ output:
{% if juju_principal_unit -%}
name: {{ juju_principal_unit }}
{%- endif %}
seccomp:
default_action: errno
syscalls:
- action: allow
names:
- clone3
1 change: 0 additions & 1 deletion wheelhouse.txt

This file was deleted.

0 comments on commit 564f6e5

Please sign in to comment.