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.