mirror of
https://git.dn42.dev/dn42/registry.git
synced 2025-07-18 08:26:58 +08:00
remove .rpsl/config in favor of schema/SCHEMA-SCHEMA
This commit is contained in:
parent
26a13274ae
commit
78421585a5
7 changed files with 29 additions and 46 deletions
|
@ -26,12 +26,12 @@ class Config:
|
|||
@property
|
||||
def schema(self) -> str:
|
||||
"Get schema type name"
|
||||
return self._dom.get("schema", default="schema").value
|
||||
return self._dom.get("namespace-schema", default="schema").value
|
||||
|
||||
@property
|
||||
def owners(self) -> str:
|
||||
"Get owner type name"
|
||||
return self._dom.get("owner", default="mntner").value
|
||||
return self._dom.get("namespace-owner", default="mntner").value
|
||||
|
||||
@property
|
||||
def source(self) -> str:
|
||||
|
@ -120,10 +120,10 @@ class Config:
|
|||
"Build config from parameters"
|
||||
FileDOM.namespace = namespace
|
||||
dom = FileDOM()
|
||||
dom.src = os.path.join(path, "config")
|
||||
dom.src = os.path.join(path, ".rpsl/config")
|
||||
dom.put("namespace", namespace)
|
||||
dom.put("schema", schema)
|
||||
dom.put("owners", owners)
|
||||
dom.put("namespace-schema", schema)
|
||||
dom.put("namespace-owners", owners)
|
||||
dom.put("default-owner", default_owner)
|
||||
for (k, v) in primary_keys:
|
||||
dom.put("primary-key", f"{k} {v}", append=True)
|
||||
|
|
|
@ -251,6 +251,8 @@ def index_files(path: str) -> FileDOM:
|
|||
if root == path:
|
||||
continue
|
||||
if root.endswith(".rpsl"):
|
||||
dom = FileDOM.from_file(os.path.join(root, "config"))
|
||||
yield dom
|
||||
continue
|
||||
|
||||
for f in files:
|
||||
|
|
|
@ -44,12 +44,12 @@ def run(args: List[str], env: Dict[str, str]) -> int:
|
|||
return 1
|
||||
|
||||
rpsl_dir = env.get("WORKING_DIR")
|
||||
schema_dir = os.path(rpsl_dir, "schema")
|
||||
schema_dir = os.path.join(rpsl_dir, "schema")
|
||||
|
||||
network_owners, primary_keys = {}, {}
|
||||
if os.path.exists(schema_dir):
|
||||
network_owners, primary_keys = _parse_schema(schema_dir)
|
||||
|
||||
print(rpsl_dir)
|
||||
rpsl = Config.build(path=rpsl_dir,
|
||||
namespace=opts.namespace,
|
||||
schema=opts.schema,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue