Thanks, i get it now. It's also viable solution.
One complication is that we would need to find a way how to deprecate
current usage of --parent in update commands and replace it with
--new-parent. But it's probably more consistent with how katello works


On Tue, Apr 11, 2017 at 1:51 PM, Andrew Kofink <[email protected]> wrote:
> Correct. If there are 2 orgs with the same name under different parents,
> then not specifying `--parent` would result in an error such as "More than
> one record found".
>
> On Tue, Apr 11, 2017 at 7:08 AM, Tomas Strachota <[email protected]>
> wrote:
>>
>> I'm not sure I understand. It is currently possible to update parents
>> of organizations. Did you mean to use the parent parameter as a
>> compound identifier together with names?
>>
>> i.e. for changing a name and a parent you would use:
>> $ hammer organization update --name Brno --parent EMEA --new-name Krno
>> --new-parent ...
>>
>> and for info:
>> $ hammer organization info --name Brno --parent EMEA
>>
>> Did I understand it correctly?
>>
>>
>> On Mon, Apr 10, 2017 at 6:12 PM, Andrew Kofink <[email protected]> wrote:
>> > Tomas,
>> >
>> > Would it be easier to print the parent with list/info commands and allow
>> > updating that attribute (i.e. --parent/--parent-id)? We already have a
>> > handler in the ID resolver when multiple records are returned when only
>> > one
>> > is expected, though the error message does not tell the user how to
>> > further
>> > filter the results.
>> >
>> > - Andrew
>> >
>> > On Mon, Apr 10, 2017 at 11:09 AM, Tomas Strachota <[email protected]>
>> > wrote:
>> >>
>> >> I recently found out hammer uses only short names for identifying
>> >> organizations. Names aren't globally unique, which makes it impossible
>> >> to modify or delete an org when there are two of the same name but
>> >> nested under a different parent org. See [1] for details.
>> >>
>> >> I opened a preliminary PR [2] that adds option --organization-title to
>> >> all commands that consume taxonomies and a column "Title" to output of
>> >> the list command. This is simple solution, consistent with how it
>> >> works in hostgroups, but I don't think it's the best from the
>> >> usability point of view. Both options --name and --title as well as
>> >> table column labels feel redundant (columns contain the same data if
>> >> orgs aren't nested).
>> >>
>> >> An alternative approach is to completely replace names with labels in
>> >> hammer internally. We would have to change id resolver and let the
>> >> list commands print titles (in a column labeled "Name"). That's how
>> >> it's displayed in UI.
>> >>
>> >> Pros:
>> >>   - users wouldn't notice the change, it should be seamless in most
>> >> cases
>> >>   - no need to add extra options
>> >>   - consistent with the UI, where column labeled "Name" contains
>> >> titles in taxonomy tables
>> >>
>> >> Cons:
>> >>   - name isn't the same as title and it might not feel natural to
>> >> update
>> >> as:
>> >>     hammer location update --name 'emea/brno' --new-name 'krno' which
>> >> would then be displayed as 'emea/krno'
>> >>
>> >> The con I mentioned could be fixed by checking if a user passed a name
>> >> containing '/' and using only last part of title in such cases. That
>> >> would make even --new-name 'emea/krno' work.
>> >>
>> >> Theoretically it could be used also for changing organizations parent.
>> >> --name 'emea/brno' --new-name 'europe/krno' would change parent to an
>> >> organization with title 'europe' and rename to 'krno'. But that's
>> >> maybe too much.
>> >>
>> >> How do you find the alternative approach? Do you see any other options
>> >> how the commands could work? Any idea is welcome.
>> >> I'd like to change hostgroup commands to use the same style and make
>> >> it consistent across the whole cli when we find a good solution. Are
>> >> there any commands in plugins (looking mainly at hammer-cli-katello)
>> >> that use resources with nested names?
>> >>
>> >> T.
>> >>
>> >> [1] http://projects.theforeman.org/issues/19157/
>> >> [2] https://github.com/theforeman/hammer-cli-foreman/pull/299
>> >>
>> >> --
>> >> 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 [email protected].
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> >
>> >
>> > --
>> > Andrew Kofink
>> > [email protected]
>> > IRC: akofink
>> > Associate Software Engineer
>> > Red Hat Satellite
>> >
>> > --
>> > 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 [email protected].
>> > 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 [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Andrew Kofink
> [email protected]
> IRC: akofink
> Associate Software Engineer
> Red Hat Satellite
>
> --
> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to