mirror of
https://github.com/vacp2p/wakurtosis.git
synced 2026-01-09 14:58:02 -05:00
Added a check for gennet config file, so if when calling from kurtosis if the gennet configuration is missing, it does not create a topology
This commit is contained in:
@@ -211,11 +211,15 @@ def generate_and_write_files(dirname, num_topics, num_subnets, G):
|
||||
|
||||
def conf_callback(ctx: typer.Context, param: typer.CallbackParam, value: str):
|
||||
if value:
|
||||
typer.echo(f"Loading config file: {value}")
|
||||
typer.echo(f"Loading config file: {value.split('/')[-1]}")
|
||||
try:
|
||||
with open(value, 'r') as f: # Load config file
|
||||
conf = json.load(f)
|
||||
conf = conf["gennet"]
|
||||
if "gennet" in conf:
|
||||
conf = conf["gennet"]
|
||||
else:
|
||||
print("Configuration not found. Skipping topology generation.")
|
||||
sys.exit(1)
|
||||
ctx.default_map = ctx.default_map or {} # Initialize the default map
|
||||
ctx.default_map.update(conf) # Merge the config dict into default_map
|
||||
except Exception as ex:
|
||||
|
||||
Reference in New Issue
Block a user