zhmcclient / zhmccli

A CLI for the IBM Z HMC
Apache License 2.0
10 stars 9 forks source link

"zhmc ldap delete" fails with TypeError #460

Closed andy-maier closed 1 year ago

andy-maier commented 1 year ago

On the HMC of T224:

$ zhmc ldap delete -y test_bb8d1218-5fb8-4258-934a-13e74efd8e40
Traceback (most recent call last):
  File "/Users/maiera/virtualenvs/zhmccli39/bin/zhmc", line 33, in <module>
    sys.exit(load_entry_point('zhmccli', 'console_scripts', 'zhmc')())
  File "/Users/maiera/virtualenvs/zhmccli39/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/maiera/virtualenvs/zhmccli39/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/maiera/virtualenvs/zhmccli39/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/maiera/virtualenvs/zhmccli39/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/maiera/virtualenvs/zhmccli39/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/maiera/virtualenvs/zhmccli39/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/maiera/virtualenvs/zhmccli39/lib/python3.9/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
TypeError: ldapdef_delete() got an unexpected keyword argument 'ldapsd'
samirgorai commented 1 year ago

Hello @andy-maier need some assistances as i am a new open source contributor. 1)Do we have to take file "zhmccli\zhmccli_cmd_ldap_server_definition.py" into consideration for the bug.

andy-maier commented 1 year ago

@samirgorai Hello Samir. Thanks for contributing!

Yes, that would be the file. The use of "click" unfortunately hides that quite a bit in the traceback, but it mentions "ldapdef_delete()" which you can find in that file.

Note that @nexuspy has already created PR #461 to fix this issue. Is he a colleague of yours, or is this a coincidence?

andy-maier commented 1 year ago

The issue is in this code:

@click.argument('LDAPSD', type=str, metavar='LDAP_SERVER_DEFINITION')
. . .
def ldapdef_delete(cmd_ctx, ldapdef):
. . .

where the LDAPSD click argument name does not match the ldapdef function argument name.

samirgorai commented 1 year ago

Hello @andy-maier Thanks for Replying . @nexuspy is also new to me.

samirgorai commented 1 year ago

@andy-maier After I made the Changes i am trying to commit using template file after executing "git commit" in cmd one file opens in vs code Screenshot 2023-09-26 202504 After Saving that file and when i return back to command line interface PS C:\Users\samir\OneDrive\Documents\Open_Source\Command_Line_Interface\zhmccli> git commit Aborting commit; you did not edit the message. the above message comes and commit does not happens . can you help me in this.

andy-maier commented 1 year ago

@samirgorai I have no experience with VSCode, so I cannot help you there.

The commands for a shell would be:

git commit -as   # brings up your configured editor for editing the commit message. Once you save and leave the editor, it continues
git push    # displays the parameters for git push that you actually need to use
andy-maier commented 1 year ago

Some hints: From the command line, you can always issue git status to see what the state of your work directory is, i.e. whether you have uncommitted changes. If you have uncommitted changes, git -asm "some reasonable commit title will commit them locally, with that line as a commit message and your signature.

andy-maier commented 1 year ago

I found this article which may help you with git on Windows: https://stackoverflow.com/a/11702707

andy-maier commented 1 year ago

Thanks @samirgorai for the PR. I have approved it and it is currently executing the test workflow.