-
Notifications
You must be signed in to change notification settings - Fork 102
Fixes #39414 - Show unrecognized smart proxy features in list and info #656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ class ListCommand < HammerCLIForeman::ListCommand | |
| field :status, _("Status") | ||
| field :url, _("URL") | ||
| field :_features, _( "Features"), Fields::List, :hide_blank => true | ||
| field :unrecognized_features, _("Unrecognized features"), Fields::List, :hide_blank => true | ||
| end | ||
|
|
||
| def extend_data(proxy) | ||
|
|
@@ -31,10 +32,18 @@ class InfoCommand < HammerCLIForeman::InfoCommand | |
| field :name, _('Name') | ||
| field :version, _('Version') | ||
| end | ||
| collection :_unrecognized_features, _("Unrecognized features"), :hide_blank => true do | ||
| field :name, _('Name') | ||
| end | ||
| HammerCLIForeman::References.taxonomies(self) | ||
| HammerCLIForeman::References.timestamps(self) | ||
| end | ||
|
|
||
| def extend_data(proxy) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd move it to the list command's # L19
def extend_data(proxy)
proxy['_features'] = proxy['features'].map { |f| f['name'] } if proxy['features']
proxy['_unrecognized_features'] = proxy['unrecognized_features'].map { |f| f['name'] } if proxy['unrecognized_features']
proxy
endInfo command here expects "correct" or "expected" response with features, that's why we don't have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For features the api returns a list of hashes, which we can use as-is in info and which we have to transform for list. For unrecognized, it is the other way around - the api gives a flat list which we can use as-is in list, but have to transform it info. That's where the asymmetry comes from. I can try messing with it a bit more, but it will probably never be as clean as we'd like |
||
| proxy['_unrecognized_features'] = proxy.delete('unrecognized_features').map { |f| { 'name' => f } } if proxy['unrecognized_features'] | ||
| proxy | ||
| end | ||
|
|
||
| build_options | ||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the sake of consistency (even if it's painful for the eyes)