Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool argument names with uppercase characters raise breaking errors when the tool is run #179

Open
DavidMarchant opened this issue Nov 19, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@DavidMarchant
Copy link
Contributor

If an argument specified in a tools config (the 'key' of the key/value pair) contains any uppercase characters in its name when run, even with valid CLI input, it will crash the system & print an ugly stack trace as so:

adminware> run cmd1 -n node dsadas  sadsada                                                       
Traceback (most recent call last):                                                                
  File "src/adminware", line 7, in <module>                                                       
    adminware()                                                                                   
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 722, in __call__     
    return self.main(*args, **kwargs)                                                             
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 697, in main         
    rv = self.invoke(ctx)                                                                         
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 1066, in invoke      
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                       
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke       
    return ctx.invoke(self.callback, **ctx.params)                                                
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke       
    return callback(*args, **kwargs)                                                              
  File "/tmp/adminware/src/appliance_cli/sandbox.py", line 31, in sandbox                         
    allow_internal_commands=False,                                                                
  File "/tmp/adminware/venv/src/click-repl/click_repl/__init__.py", line 194, in repl             
    group.invoke(ctx)                                                                             
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 1066, in invoke      
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                       
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 1066, in invoke      
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                       
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke       
    return ctx.invoke(self.callback, **ctx.params)                                                
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke       
    return callback(*args, **kwargs)                                                              
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)                                              
  File "/tmp/adminware/src/appliance_cli/command_generation.py", line 136, in click_callback      
    params[arg_name] for arg_name in arguments.keys()                                             
  File "/tmp/adminware/src/appliance_cli/command_generation.py", line 136, in <listcomp>          
    params[arg_name] for arg_name in arguments.keys()                                             
KeyError: 'INPUT'                                                                                 

This acts similarly for any uppercase chars; inpuT as a name would also error.

This is likely due to some down-casing before entry into the params dict resulting in a KeyError on attempted lookup.

This should either be fixed such that arguments with uppercase chars in their names are valid or such that the system errors in a much more graceful way, either on startup when the configs are loaded or when the tool's attempted to be ran.

@WilliamMcCumstie
Copy link
Contributor

@DavidMarchant Can you give an example of the config.yaml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants