DUNE-DAQ / nanorc

2 stars 2 forks source link

Path checking problems for expert command, import and export in integration test #218

Closed LJoyL closed 9 months ago

LJoyL commented 10 months ago

Can't implement expert_command with path to module name with error "Couldn't find {prompted_path} in the tree" because the tree has not yet been populate by the others commands.

Looks like the path is being checked before the execution time of the command here : "@accept_path(argument=True)".

hot fix on my local nanorc : replace @accept_path(argument=True) by @click.argument('node-path', type=str)

Move the node check and retrive it when sending the command.

# Check path validity when sending the command and not before for integtest compatibility
topnode = self.topnode
node = None
r = Resolver('name')
try:
    node = r.get(topnode, node_path)
except Exception as ex:
    raise click.BadParameter(f"Couldn't find {node_path} in the tree") from ex
plasorak commented 10 months ago

Hi Leo, I think this is an acceptable solution, would you be able to create a PR with it? Thanks.

plasorak commented 9 months ago

This has been merged and worked right?