Actions
Bug #27632
closedActivation Key create API is lacking parameters that are possible during update
Difficulty:
trivial
Triaged:
Yes
Pull request:
Description
When creating a new Activation Key, the following params are missing (compared to updating an existing one)
param :release_version, String, :desc => N_("content release version")
param :service_level, String, :desc => N_("service level")
param :auto_attach, :bool, :desc => N_("auto attach subscriptions upon registration")
If I read the underlying Katello/Candlepin code correctly, this is because Candlepin cannot set these on create. I think Katello should "fix" that for the user and execute an update after create itself, like we already do in copy:
api :POST, "/activation_keys/:id/copy", N_("Copy an activation key")
param :new_name, String, :desc => N_("Name of new activation key"), :required => true
param :id, :number, :desc => N_("ID of the activation key"), :required => true
param :organization_id, :number, :desc => N_("organization identifier"), :required => false
def copy
fail HttpErrors::BadRequest, _("New name cannot be blank") unless params[:new_name]
@new_activation_key = @activation_key.copy(params[:new_name])
@new_activation_key.user = current_user
sync_task(::Actions::Katello::ActivationKey::Create, @new_activation_key)
@new_activation_key.reload
sync_task(::Actions::Katello::ActivationKey::Update, @new_activation_key,
:service_level => @activation_key.service_level,
:release_version => @activation_key.release_version,
:auto_attach => @activation_key.auto_attach
)
@activation_key.pools.each do |pool|
@new_activation_key.subscribe(pool[:id])
end
@new_activation_key.set_content_overrides(@activation_key.content_overrides) unless @activation_key.content_overrides.blank?
respond_for_create(:resource => @new_activation_key)
end
Updated by Samir Jha almost 7 years ago
- Target version set to Katello Backlog
- Difficulty set to trivial
- Triaged changed from No to Yes
Updated by The Foreman Bot almost 7 years ago
- Status changed from New to Ready For Testing
- Assignee set to Jonathon Turel
- Pull request https://github.com/Katello/katello/pull/8313 added
Updated by The Foreman Bot almost 7 years ago
- Fixed in Releases Katello 3.14.0 added
Updated by Jonathon Turel almost 7 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|38356ed2a8e97effd3f25aebf300c05850dd36a5.
Updated by Evgeni Golov almost 7 years ago
- Related to Tracker #27680: API bugs that need workarounds in foreman-ansible-modules added
Actions