Skip to content

Commit d1a3809

Browse files
C8Y-Marioreubenmiller
authored andcommitted
fix lint issues
1 parent 2e72a7f commit d1a3809

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ cleanup DEVICE_ID $CI="true":
6060
echo "Removing device and child devices (including certificates)"
6161
c8y devicemanagement certificates list -n --tenant "$(c8y currenttenant get --select name --output csv)" --filter "name eq ${DEVICE_ID}" --pageSize 2000 | c8y devicemanagement certificates delete --tenant "$(c8y currenttenant get --select name --output csv)"
6262
c8y inventory find -n --owner "device_${DEVICE_ID}" -p 100 | c8y inventory delete
63-
c8y users delete -n --id "device_${DEVICE_ID}$" --tenant "$(c8y currenttenant get --select name --output csv)" --silentStatusCodes 404 --silentExit
63+
c8y users delete -n --id "device_${DEVICE_ID}$" --tenant "$(c8y currenttenant get --select name --output csv)" --silentStatusCodes 404 --silentExit

tedge_modbus/operations/c8y_modbus_configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ def run(arguments, context: Context):
3434
modbus_config["modbus"]["pollinterval"] = polling_rate
3535

3636
# Save to file
37-
logger.info("Saving new configuration to %s", config_path)
38-
with open(config_path, "w", encoding="utf8") as f:
37+
logger.info("Saving new configuration to %s", context.base_config_path)
38+
with open(context.base_config_path, "w", encoding="utf8") as f:
3939
toml.dump(modbus_config, f)
40-
logger.info("New configuration saved to %s", config_path)
4140

4241
# Update managedObject
4342
logger.debug("Updating managedObject with new configuration")

tedge_modbus/operations/c8y_modbus_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def parse_arguments(arguments) -> ModebusDevice:
8686

8787

8888
def run(arguments, context: Context):
89+
"""main"""
8990
loglevel = context.base_config["modbus"]["loglevel"] or "INFO"
9091
logger.setLevel(getattr(logging, loglevel.upper(), logging.INFO))
91-
"""main"""
9292
logger.info("New c8y_ModbusDevice operation")
9393
# Check and store arguments
9494
if len(arguments) != 8:

tedge_modbus/operations/context.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44
from dataclasses import dataclass
55
from pathlib import Path
6-
6+
import toml
77

88
@dataclass
99
class Context:
@@ -14,6 +14,7 @@ class Context:
1414
port = 1883
1515
client_id = "c8y_ModbusConfiguration-operation-client"
1616
config_dir = Path("/etc/tedge/plugins/modbus")
17+
base_config_path = config_dir / "modbus.toml"
1718

1819
@property
1920
def c8y_proxy(self) -> str:
@@ -37,5 +38,5 @@ def device_id(self):
3738

3839
@property
3940
def base_config(self):
40-
config_path = config_dir / "modbus.toml"
41-
return toml.load(config_path)
41+
"""loads the default modbus.toml file and gives it back as dict"""
42+
return toml.load(self.base_config_path)

0 commit comments

Comments
 (0)