Verified Commit de95ad5e authored by Štěpán Henek's avatar Štěpán Henek 🌩

turris-maintain: credentials fix

parent c3d68e47
#
## Copyright (C) 2018 CZ.NIC z.s.p.o. (http://www.nic.cz/)
## Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
#
## This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
......@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=turris-maintain
PKG_VERSION:=6
PKG_VERSION:=7
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
......
......@@ -3,6 +3,7 @@
import uci
import time
import json
import re
import subprocess
TIME = 2000
......@@ -36,8 +37,13 @@ elif bus == "unix":
elif bus == "mqtt":
host = uci_get("foris-controller", "mqtt", "host", "localhost")
port = int(uci_get("foris-controller", "mqtt", "port", 11883))
passwd_path = uci_get(
"foris-controller", "mqtt", "credentials_file", "/etc/fosquitto/credentials.plain"
)
with open(passwd_path, "r") as f:
credentials = re.match(r"^([^:]+):(.*)$", f.readlines()[0][:-1]).groups()
from foris_controller.buses.mqtt import MqttNotificationSender
sender = MqttNotificationSender(host, port)
sender = MqttNotificationSender(host, port, credentials)
ips = []
# try to detect ips from uci
......
......@@ -3,6 +3,7 @@
import uci
import time
import json
import re
import subprocess
TIME = 3000
......@@ -36,8 +37,13 @@ elif bus == "unix":
elif bus == "mqtt":
host = uci_get("foris-controller", "mqtt", "host", "localhost")
port = int(uci_get("foris-controller", "mqtt", "port", 11883))
passwd_path = uci_get(
"foris-controller", "mqtt", "credentials_file", "/etc/fosquitto/credentials.plain"
)
with open(passwd_path, "r") as f:
credentials = re.match(r"^([^:]+):(.*)$", f.readlines()[0][:-1]).groups()
from foris_controller.buses.mqtt import MqttNotificationSender
sender = MqttNotificationSender(host, port)
sender = MqttNotificationSender(host, port, credentials)
ips = []
# try to detect ips from uci
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment