Bug #8237

Can set a bad max_content_hosts value when unlimited_content_hosts is true

Added by Bryan Kearney over 7 years ago. Updated almost 4 years ago.

Target version:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:


Cloned from
Description of problem:
Creating an activation key with these options fails, as it should:

  • max_content_hosts=-5
  • max_content_hosts='ABcd37'

However, creating an activation key with these options succeed:

  • unlimited_content_hosts=True, max_content_hosts=-5
  • unlimited_content_hosts=True, max_content_hosts='ABcd37'
  • unlimited_content_hosts=True, max_content_hosts=5

As demonstrated above, the API allows an invalid value for the `max_content_hosts` argument when `unlimited_content_hosts` is true. When this occurs, the `max_content_hosts` option is entirely ignored. Here's a concrete example:

>>> attrs = entities.ActivationKey(
... max_content_hosts='ABcd37',
... unlimited_content_hosts=True
... ).create()
>>> for attr in ('max_content_hosts', 'unlimited_content_hosts'):
... print(attrs[attr])

Version-Release number of selected component (if applicable):
Tested against a nightly build of Satellite 6 on a machine with the following packages installed:

  • apr-util-ldap-1.3.9-3.el6_0.1.x86_64
  • candlepin-0.9.32-1.el6.noarch
  • candlepin-common-1.0.8-1.el6.noarch
  • candlepin-selinux-0.9.32-1.el6.noarch
  • candlepin-tomcat6-0.9.32-1.el6.noarch
  • elasticsearch-0.90.10-7.el6.noarch
  • foreman-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • foreman-compute-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • foreman-gce-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • foreman-libvirt-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • foreman-ovirt-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • foreman-postgresql-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • foreman-proxy-1.7.0-0.develop.201410221520gitccd77aa.el6.noarch
  • foreman-release-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • foreman-selinux-1.7.0-0.develop.201410210825gitaab37c6.el6.noarch
  • foreman-vmware-1.7.0-0.develop.201410232354git5e8706d.el6.noarch
  • katello-2.1.0-1.201410231000gitac15899.el6.noarch
  • katello-certs-tools-2.0.1-1.el6.noarch
  • katello-default-ca-1.0-1.noarch
  • katello-installer-2.1.0-1.201410162242git33b9fc3.el6.noarch
  • katello-repos-2.1.1-1.el6.noarch
  • katello-server-ca-1.0-1.noarch
  • openldap-2.4.23-32.el6_4.1.x86_64
  • pulp-docker-plugins-0.2.1-0.2.beta.el6.noarch
  • pulp-katello-0.3-3.el6.noarch
  • pulp-nodes-common-2.5.0-0.7.beta.el6.noarch
  • pulp-nodes-parent-2.5.0-0.7.beta.el6.noarch
  • pulp-puppet-plugins-2.5.0-0.7.beta.el6.noarch
  • pulp-puppet-tools-2.5.0-0.7.beta.el6.noarch
  • pulp-rpm-plugins-2.5.0-0.7.beta.el6.noarch
  • pulp-selinux-2.5.0-0.7.beta.el6.noarch
  • pulp-server-2.5.0-0.7.beta.el6.noarch
  • python-ldap-2.3.10-1.el6.x86_64
  • ruby193-rubygem-ldap_fluff-0.3.2-1.el6.noarch
  • ruby193-rubygem-net-ldap-0.3.1-2.el6.noarch
  • ruby193-rubygem-runcible-1.2.0-1.el6.noarch

How reproducible:

Steps to Reproduce:
See "Description of problem" section at top of post.

Actual results:
an activation key is created.

Expected results:
No activation key is created.

Additional info:
The API exhibits a similar bug, though its behaviour is not identical.

Associated revisions

Revision 70b4eddb (diff)
Added by Bryan Kearney over 7 years ago

Fixes #8237 : Validate that the user can not set max_content_hosts if unlimited_content_hosts is true

Revision c851aa15
Added by Bryan Kearney over 7 years ago

Merge pull request #4790 from bkearney/bkearney/8237

Fixes #8237 : Validate that the user can not set max_content_hosts if un...


#1 Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Target version set to 59
  • Pull request added
  • Pull request deleted ()

#2 Updated by Eric Helms over 7 years ago

  • Legacy Backlogs Release (now unused) set to 14
  • Triaged changed from No to Yes

#3 Updated by Eric Helms over 7 years ago

  • Target version changed from 59 to 61

#4 Updated by Bryan Kearney over 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF