Skip to content
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

Fixes #37881 - Update global reg form for multi-env AKs and clean up loose ends #11169

Merged
merged 4 commits into from
Oct 28, 2024

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Oct 4, 2024

What are the changes introduced in this pull request?

image

  1. Update the global registration form to display content view environment labels, including for multi-env AKs, and not just lifecycle environments.
  2. Rename candlepin_name and candlepin_names methods and method arguments to labels throughout the Ruby codebase.
  3. Update the description of the allow_multiple_content_views Setting

Considerations taken when implementing this change?

This resolves the outstanding issues mentioned in #11161 (comment)

It also cleans up the loose end with the setting description, and eliminates a TODO comment.

What are the testing steps for this pull request?

This should affect these places in the UI - make sure everything works ok:

  1. Global Registration form - Activation Keys dropdown
  2. Host details Repository Sets tab - banner text when your host is multi-environment

also, the method name changes affect multi-env hosts and AKs, so test some updates and make sure everything still works.

@@ -7,7 +7,7 @@ def plugin_data
aks = ActivationKey.authorized(:view_activation_keys)
.where(organization_id: registration_params[:organization_id])
.order(:name)
.map { |ak| { name: ak.name, lce: ak.environment&.name } }
.map { |ak| { name: ak.name, cves: ak.content_view_environments.map(&:label).join(', ') } }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the space after comma necessary ? does it work ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you were copy/pasting to hammer with the spaces you'd need quotes. But this is just for displaying in the web UI, so I thought the spaces just looked nicer.

@@ -26,8 +26,8 @@ child :content_view_environments => :content_view_environments do
lifecycle_environment_library: cve.lifecycle_environment&.library?
}
end
node :candlepin_name do |cve|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I 'd be nervous to do this for an api response. Can we may be have both ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code that introduced this API response node was just merged today IIRC, so I don't think anyone relies on it yet. Thoughts?

@jeremylenz
Copy link
Member Author

Also updated the setting description since multiCV works with both hosts and AKs now.

@jeremylenz jeremylenz changed the title Fixes #37881 - Update global reg form for multi-env AKs Fixes #37881 - Update global reg form for multi-env AKs and clean up loose ends Oct 8, 2024
@jeremylenz
Copy link
Member Author

rebased

Copy link
Contributor

@qcjames53 qcjames53 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been able to verify that the activation keys dropdown on the global registration form displays the correct lifecycle environment and content view pairs in a variety of circumstances; anything from 0 to 10 pairs seems to work without issue. Selecting and using an activation key while registering a host still works the same as before.

After a host is registered using host registration, the banner on top of the Host Details → Content → Repository Sets tab is able to appropriately describe the repository sets being displayed. All repos, repos from one environment, and repos from more than one environment seem to display well.

I'm going to ACK, but there are still two issues for which I wanted to get your opinion:

1 - The help text still refers to 'Candlepin environment names' instead of labels. Is this intentional? 'le_label/cv_label' is the correct format, but I'm not sure if you wanted to replace this since you replaced a lot of other references to environment name:

$hammer activation-key update --help
...
 --content-view-environments LIST               Comma-separated list of Candlepin environment names to be associated with the
                                                activation key, in the format of
                                                'lifecycle_environment_label/content_view_label'. Ignored if
                                                content_view_environment_ids is specified, or if content_view_id and
                                                lifecycle_environment_id are specified. Requires allow_multiple_content_views
                                                setting to be on.

2 - If a user edits the AC or host to contain the Library/Library content view environment (via using activation-key update --content-view-environment-ids 1,... or host update...) the banner on the repository sets tab will not render. I don't believe this will be an issue for users since as far as I can tell Library/Library is an invalid CV for a host.

@jeremylenz
Copy link
Member Author

The help text still refers to 'Candlepin environment names' instead of labels. Is this intentional? 'le_label/cv_label' is the correct format, but I'm not sure if you wanted to replace this since you replaced a lot of other references to environment name

Good catch! Updated.

If a user edits the AC or host to contain the Library/Library content view environment (via using activation-key update --content-view-environment-ids 1,... or host update...) the banner on the repository sets tab will not render. I don't believe this will be an issue for users since as far as I can tell Library/Library is an invalid CV for a host.

I'm concerned; how did you achieve this? When you do this you should get an error:

$ hammer activation-key update --organization-id 1 --name ak5 --content-view-environments Library/Library
Could not update the activation key:
  No content view environments found with names: Library/Library

(side note: When a host is associated with Library and not Library/Library, it's normal for the banner and toggle group not to appear.)

@qcjames53
Copy link
Contributor

I was able to use --content-view-environment-ids to bypass the error. On my environment, Library/Library was id 1.

@jeremylenz
Copy link
Member Author

On my environment, Library/Library was id 1.

Can you show me that? Its label should be Library, not Library/Library

@qcjames53
Copy link
Contributor

You're correct, thank you 🙏. Id 1 is 'Library'

@jeremylenz jeremylenz merged commit e1dc9cf into Katello:master Oct 28, 2024
26 of 27 checks passed
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.

3 participants