-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split hunt driver from hunt instances to ease manual search
- Loading branch information
1 parent
124e617
commit c44b9a6
Showing
6 changed files
with
128 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import os | ||
import json | ||
import subprocess | ||
from pathlib import Path | ||
from dataclasses import dataclass | ||
|
||
|
||
|
||
@dataclass | ||
class DockerComposeWriter: | ||
filepath: str | ||
|
||
def set_dev_mode(self, dev): | ||
self.__dev = dev | ||
|
||
def write(self): | ||
text = '''version: '3' | ||
services: | ||
# docker compose run --service-ports mosquitto | ||
mosquitto: | ||
image: eclipse-mosquitto | ||
user: "${UID}:${GID}" | ||
ports: | ||
- 1883:1883 | ||
- 9001:9001 | ||
volumes: | ||
- ./data/mosquitto.conf:/mosquitto/config/mosquitto.conf | ||
panduza-py-platform: | ||
''' | ||
if not self.__dev: | ||
text += ''' image: ghcr.io/panduza/panduza-py-platform:latest | ||
# To use your local platform build | ||
# image: local/panduza-py-platform | ||
''' | ||
else: | ||
text += '''# image: ghcr.io/panduza/panduza-py-platform:latest | ||
# To use your local platform build | ||
image: local/panduza-py-platform | ||
''' | ||
text += '''privileged: true | ||
network_mode: host | ||
user: "${UID}:${GID}" | ||
environment: | ||
- HUNT | ||
volumes: | ||
- .:/etc/panduza | ||
- /run/udev:/run/udev:ro | ||
# command: bash | ||
''' | ||
|
||
# Write the file | ||
with open(self.filepath, 'w') as f: | ||
print(f" + Write file '{self.filepath}'") | ||
f.write(text) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
import json | ||
import subprocess | ||
from pathlib import Path | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class TreeWriter: | ||
filepath: str | ||
|
||
def write(self): | ||
tree = { | ||
"machine": "rename_this_machine", | ||
"brokers": { | ||
"rename_this_broker": { | ||
"addr": "localhost", | ||
"port": 1883, | ||
"interfaces": [ | ||
{ | ||
"name": "fake_psu", | ||
"driver": "py.psu.fake" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
with open(self.filepath, 'w') as f: | ||
print(f" + Write file '{self.filepath}'") | ||
f.write(json.dumps(tree, indent=4)) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters