mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
cmds.secrets.lib: Add missing bits
- cmds.secrets.lib.base: Add module - cmds.secrets.lib.util: Fix missing Attrs type Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
c238a0d2d0
commit
003d53b310
2 changed files with 43 additions and 1 deletions
35
src/python/jw/pkg/cmds/secrets/lib/base.py
Normal file
35
src/python/jw/pkg/cmds/secrets/lib/base.py
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Attrs:
|
||||||
|
|
||||||
|
mode: int | None = None
|
||||||
|
owner: str | None = None
|
||||||
|
group: str | None = None
|
||||||
|
conf: str | None = None
|
||||||
|
|
||||||
|
def update(self, rhs: Args|None) -> Args:
|
||||||
|
if rhs is not None:
|
||||||
|
if rhs.mode:
|
||||||
|
self.mode = rhs.mode
|
||||||
|
if rhs.owner:
|
||||||
|
self.owner = rhs.owner
|
||||||
|
if rhs.group:
|
||||||
|
self.group = rhs.group
|
||||||
|
if rhs.conf:
|
||||||
|
self.conf = rhs.conf
|
||||||
|
return self
|
||||||
|
|
||||||
|
def emtpy(self) -> bool:
|
||||||
|
if self.mode is not None:
|
||||||
|
return False
|
||||||
|
if self.owner is not None:
|
||||||
|
return False
|
||||||
|
if self.group is not None:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
@ -1,9 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from ....lib.ec.FileContext import FileContext
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from ....lib.FileContext import FileContext
|
||||||
from ....lib.ec.Local import Local
|
from ....lib.ec.Local import Local
|
||||||
from .FilesContext import FilesContext
|
from .FilesContext import FilesContext
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .base import Attrs
|
||||||
|
|
||||||
async def compile_template_file(target_path: str, default_attrs: Attrs|None=None, ctx: FileContext|None=None) -> bool:
|
async def compile_template_file(target_path: str, default_attrs: Attrs|None=None, ctx: FileContext|None=None) -> bool:
|
||||||
if ctx is None:
|
if ctx is None:
|
||||||
ctx = Local()
|
ctx = Local()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue