Skip to content

Fixes #38957 - Add descriptions to model create/update options - #661

Closed
anandjambhulkar wants to merge 1 commit into
theforeman:masterfrom
anandjambhulkar:fixes-38957-model-option-descriptions
Closed

anandjambhulkar wants to merge 1 commit into
theforeman:masterfrom
anandjambhulkar:fixes-38957-model-option-descriptions

Conversation

@anandjambhulkar

Copy link
Copy Markdown

Summary

  • Add help descriptions for hammer model create options
  • Add help descriptions for hammer model update options, including --id and --new-name

Related issue

Fixes https://projects.theforeman.org/issues/38957

Test plan

  • hammer model create --help shows descriptions for --name, --info, --vendor-class, --hardware-model
  • hammer model update --help shows descriptions for --id, --name, --new-name, and other model fields

@ofedoren ofedoren left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @anandjambhulkar, but I'm afraid I'd reject this PR, see the comment inline.

But, instead of closing, I'll keep it open with the requested changes status, so we can see if there will be something needed even if the API side is fixed.

success_message _("Hardware model created.")
failure_message _("Could not create the hardware model")

option '--name', 'NAME', _('Name of the hardware model'), :required => true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are few issues with this:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ofedoren. Thanks for reviewing my PR, and suggesting where the problem lies. I can perform some modifications in the above stated file to fix the issue. Would that be fine? Please let me know. Thanks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anandjambhulkar , ideally we don't even need to change this file at all. As I've mentioned those options should be created by hammer automatically based on the API documentation. So, to get the descriptions, we should first provide them on the API side: https://github.com/theforeman/foreman/blob/develop/app/controllers/api/v2/models_controller.rb#L24-L27.

So, as a first step I would do is to create a PR against Foreman, add those descriptions in the mentioned file and see if hammer is able to fetch and show them automatically (without this PR).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ofedoren. Thanks for your suggestions. I have made modifications to the above file that you have suggested, and tested it on my Satellite Server, and it works successfully. Thus, as per your guidance, I have created another PR against Foreman, whose URL is as follows - theforeman/foreman#11221. Let me know if I should close this current PR or not.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks. I've approved the theforeman/foreman#11221, so we no longer need this PR at all :) Would you mind closing it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely @ofedoren. I will go ahead and close out this PR immediately.

@anandjambhulkar

Copy link
Copy Markdown
Author

Closing out this PR as the following PR related to this has been approved and merged - theforeman/foreman#11221.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants