feat: add samba and proxmox modules, update config with node secrets
This commit is contained in:
parent
a80be5d8aa
commit
9c8c771cb1
7 changed files with 203 additions and 6 deletions
|
|
@ -12,12 +12,12 @@ class Config:
|
|||
if not os.path.exists(self.path):
|
||||
# Fallback to local config if exists
|
||||
if os.path.exists("config.yaml"):
|
||||
self.path = "config.yaml"
|
||||
self.path = os.path.abspath("config.yaml")
|
||||
else:
|
||||
raise FileNotFoundError(f"Config file not found at {self.path}. Please create it based on config.yaml.example")
|
||||
|
||||
with open(self.path, 'r') as f:
|
||||
return yaml.safe_vars(f) if hasattr(yaml, 'safe_vars') else yaml.safe_load(f)
|
||||
return yaml.safe_load(f)
|
||||
|
||||
def get(self, key, default=None):
|
||||
parts = key.split('.')
|
||||
|
|
@ -28,3 +28,20 @@ class Config:
|
|||
else:
|
||||
return default
|
||||
return val
|
||||
|
||||
def get_node(self, node_name):
|
||||
"""Helper to get proxmox node details by name or default to first if none provided"""
|
||||
nodes = self.get('proxmox.nodes', {})
|
||||
if not nodes:
|
||||
# Fallback for old single-host config if present
|
||||
host = self.get('proxmox.host')
|
||||
if host:
|
||||
return {"host": host, "pass": self.get('proxmox.password')}
|
||||
return None
|
||||
|
||||
if not node_name:
|
||||
# Default to first node found
|
||||
return next(iter(nodes.values()))
|
||||
|
||||
return nodes.get(node_name)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue