Until we do the proper refactoring I’d stay with my previous proposal.
Feel free to ping me and we can discuss it via hangout. Can you please send
me the issue you’re working on or what commands are affected? I’ll take a
look at it prior to our chat.
T.
Tomas,
Right now, if I add a searchable for organization-id to the
:content_views resource, the option is scoped as
–content-view-organization-id. I think it may be beneficial to modify
the DependentSearchablesOptionBuilder in hammer-cli-foreman to accept
another option, scope_to_resource. This option would default to ‘true’,
and the behavior would remain as is, but if it’s set to ‘false’, this
logic
<
https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/option_builders.rb#L232
would change to make the option at the top level (i.e. --organization-id
instead of --content-view-organization-id). Here’s what I was thinking:
https://gist.github.com/akofink/c1682bfbdf70e848deeed7be6eb31063
The SEARCHABLES array would accept options like this:
SEARCHABLES = {
:hostgroup => [
s_name(_(“Hostgroup name”)),
s(“title”, _(“Hostgroup title”), editable: false,
scope_to_resource: false)
]
}
I wanted to run this by you before beginning work on it to make sure it
seems sensible. Also, since the logic wouldn’t be Katello specific, the
change should be able to go into hammer-cli-foreman; Extending the
DependentSearchablesOptionBuilder from hammer-cli-katello seems like it
might get messy.
Thanks,
Andrew Kofink
Software Engineering Intern
Red Hat Satellite 6
akofink@redhat.com mailto:akofink@redhat.com
On Tue, Jul 26, 2016 at 5:01 AM, Tomas Strachota <tstrachota@redhat.com >> mailto:tstrachota@redhat.com> wrote:
On 07/22/2016 09:01 PM, Andrew Kofink wrote:
Hi Team (especially Martin and Tomas),
I've been banging my head on the table for a few days now, so I
thought
I would just ask:
I want to resolve a content view by its name; currently,
content_views#index has no required parameters, so no automatic
options
are generated. I would like to add the option to search for the
content
view by organization_id, and I also want hammer to add the
options for
resolving that organization_id from the organization_name and
organization_label. Lastly, and probably most important, I want
this to
happen any time the option --content-view-id is added to a
command.
This works downstream because organization_id is a required
parameter on
content_views#index, but upstream is currently broken due to a
change in
the API that removes that requirement. Any thoughts?
Hi Andrew,
I don't think there's a simple way to achieve this across the whole
hammer. You can either create a module with such behaviour and
include it into each command that uses content views (annoying I
know) or create a custom option builder for katello commands
(descendant of [1]). It will probably require some tuning of the
resolver too, but should give you what you want in the end.
T.
[1]
https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/option_builders.rb#L103
Regards,
Andrew Kofink
akofink on IRC
Software Engineering Intern
Red Hat Satellite 6
akofink@redhat.com <mailto:akofink@redhat.com>
<mailto:akofink@redhat.com <mailto:akofink@redhat.com>>
--
You received this message because you are subscribed to the Google
Groups "foreman-dev" group.
To unsubscribe from this group and stop receiving emails from
it, send
an email to foreman-dev+unsubscribe@googlegroups.com
<mailto:foreman-dev%2Bunsubscribe@googlegroups.com>
<mailto:foreman-dev+unsubscribe@googlegroups.com
<mailto:foreman-dev%2Bunsubscribe@googlegroups.com>>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to foreman-dev+unsubscribe@googlegroups.com
<mailto:foreman-dev%2Bunsubscribe@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
–
You received this message because you are subscribed to the Google
Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-dev+unsubscribe@googlegroups.com
mailto:foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.