Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added fqdn-changed event when setting fqdn #613

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

import json
import os
import sys

import agent

request = json.load(sys.stdin)

redis_client = agent.redis_connect(privileged=True)
redis_client.publish(f'{os.getenv("AGENT_ID")}/event/fqdn-changed', json.dumps({
"hostname": request["hostname"],
"domain": request["domain"],
Tbaile marked this conversation as resolved.
Show resolved Hide resolved
"node": int(os.getenv("NODE_ID")),
}))
5 changes: 5 additions & 0 deletions docs/core/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ Events fired by the `cluster` agent (i.e. channel is `cluster/event/<event name>
- `leader-changed`: a node was promoted to leader. The `node_id` attribute
indicates the new leader, and `endpoint` its public Wireguard VPN endpoint address

## Node events

Events fired by the `node` agent (i.e. channel is `node/<node id>/event/<event name>`):
- `fqdn-changed`: the node FQDN has changed. The `hostname` and `domain` attribute describe the new FQDN, while the `node` attribute contains the node ID that originated the event

## Signaling events

To signal an event, just [PUBLISH](https://redis.io/commands/PUBLISH) a message to the channel.
Expand Down
Loading