Skip to content

Fixes #39414 - Show unrecognized smart proxy features in list and info#656

Open
adamruzicka wants to merge 4 commits into
theforeman:masterfrom
adamruzicka:unknown-proxy-features
Open

Fixes #39414 - Show unrecognized smart proxy features in list and info#656
adamruzicka wants to merge 4 commits into
theforeman:masterfrom
adamruzicka:unknown-proxy-features

Conversation

@adamruzicka

@adamruzicka adamruzicka commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Companion to theforeman/foreman#11017

Display unrecognized_features from the Foreman API response in both the list and info commands, hidden when blank.

# bundle exec ruby bin/hammer proxy list
---|-----------|-----------------------|-----------------------|----------------------
ID | NAME      | URL                   | FEATURES              | UNRECOGNIZED FEATURES
---|-----------|-----------------------|-----------------------|----------------------
1  | localhost | http://localhost:8000 | Dynflow, Script, Logs | openscap
---|-----------|-----------------------|-----------------------|----------------------
# bundle exec ruby bin/hammer proxy info --id 1
Id:                    1
Name:                  localhost
URL:                   http://localhost:8000
Unrecognized features: openscap
Host count:            0
Features:
 1) Name: Dynflow
 2) Name: Script
 3) Name: Logs
Unrecognized features: openscap
Locations:
    Default Location
Organizations:
    Default Organization
Created at:            2026/01/05 13:23:58
Updated at:            2026/06/10 13:43:27

To be squashed on merge

@ofedoren

Copy link
Copy Markdown
Member

Just a nit:

Features:
 1) Name: Dynflow
 2) Name: Script
 3) Name: Logs
Unrecognized features: openscap

Can we unify the output? I mean either it's just a comma-separated list or "numerized lines", having both feels weird.

Display unrecognized_features from the Foreman API response in both
the list and info commands, hidden when blank.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adamruzicka adamruzicka force-pushed the unknown-proxy-features branch from ac1725f to aa67933 Compare June 10, 2026 14:46
@adamruzicka adamruzicka changed the title Fixes #XXXXX - Show unrecognized smart proxy features in list and info Fixes #39414 - Show unrecognized smart proxy features in list and info Jun 10, 2026
@adamruzicka

Copy link
Copy Markdown
Contributor Author

Unified

# bundle exec ruby bin/hammer proxy info --id 1
Id:                    1
Name:                  localhost
URL:                   http://localhost:8000
Unrecognized features: openscap
Host count:            0
Features:
 1) Name: Dynflow
 2) Name: Script
 3) Name: Logs
Unrecognized features:
 1) Name: openscap
Locations:
    Default Location
Organizations:
    Default Organization
Created at:            2026/01/05 13:23:58
Updated at:            2026/06/10 13:43:27

@adamruzicka

Copy link
Copy Markdown
Contributor Author

And now even without listing the unrecognized features twice

# bundle exec ruby bin/hammer proxy info --id 1
Id:                    1
Name:                  localhost
URL:                   http://localhost:8000
Host count:            0
Features:
 1) Name: Dynflow
 2) Name: Script
 3) Name: Logs
Unrecognized features:
 1) Name: openscap
Locations:
    Default Location
Organizations:
    Default Organization
Created at:            2026/01/05 13:23:58
Updated at:            2026/06/10 13:43:27

field :status, _("Status")
field :url, _("URL")
field :_features, _( "Features"), Fields::List, :hide_blank => true
field :unrecognized_features, _("Unrecognized features"), Fields::List, :hide_blank => 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.

Just for the sake of consistency (even if it's painful for the eyes)

Suggested change
field :unrecognized_features, _("Unrecognized features"), Fields::List, :hide_blank => true
field :_unrecognized_features, _("Unrecognized features"), Fields::List, :hide_blank => true

HammerCLIForeman::References.timestamps(self)
end

def extend_data(proxy)

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.

I'd move it to the list command's extend_data and merge that:

# 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
end

Info command here expects "correct" or "expected" response with features, that's why we don't have _ workaround, but for list command we do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

@adamruzicka adamruzicka marked this pull request as ready for review June 12, 2026 12:39
@ofedoren ofedoren self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants