Bug 1156555 - Can set a bad max_content_hosts value when unlimited_content_hosts is true
Summary: Can set a bad max_content_hosts value when unlimited_content_hosts is true
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API - Content
Version: Nightly
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: Unspecified
Assignee: Bryan Kearney
QA Contact: Katello QA List
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-24 16:23 UTC by jaudet
Modified: 2017-01-13 20:56 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-13 20:56:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 8237 0 'Normal' 'Closed' 'Can set a bad max_content_hosts value when unlimited_content_hosts is true' 2019-12-04 16:23:25 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description jaudet 2014-10-24 16:23:49 UTC
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])
    ... 
    None
    True

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:
100%

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.

Comment 1 jaudet 2014-10-24 16:31:09 UTC
A test is in place for this bug. See: https://github.com/SatelliteQE/robottelo/pull/1619

Comment 2 RHEL Program Management 2014-10-24 16:33:07 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 4 Bryan Kearney 2014-10-31 17:40:41 UTC
Created redmine issue http://projects.theforeman.org/issues/8237 from this bug

Comment 5 Bryan Kearney 2014-11-25 15:05:09 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/8237 has been closed
-------------
Bryan Kearney
Applied in changeset commit:katello|70b4eddb1bc174698390e7b58f18f866f9936831.

Comment 8 Tazim Kolhar 2015-02-13 07:03:30 UTC
VERIFIED:

# rpm -qa | grep foreman
foreman-postgresql-1.7.2.4-1.el7sat.noarch
foreman-vmware-1.7.2.4-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.4-1.el7.noarch
foreman-compute-1.7.2.4-1.el7sat.noarch
ruby193-rubygem-foreman_docker-1.1.0.2-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.1-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.1-1.el7.noarch
ruby193-rubygem-foreman_openscap-0.3.0-1.el7sat.noarch
foreman-1.7.2.4-1.el7sat.noarch
foreman-gce-1.7.2.4-1.el7sat.noarch
ruby193-rubygem-foreman_abrt-0.0.5-2.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.3-1.el7sat.noarch
qe-sat6-rhel7.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-selinux-1.7.2.8-1.el7sat.noarch
foreman-ovirt-1.7.2.4-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.0.7-2.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.4-1.el7.noarch
foreman-proxy-1.7.2.1-1.el7sat.noarch
foreman-libvirt-1.7.2.4-1.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.4-1.el7sat.noarch
qe-sat6-rhel7.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel7.usersys.redhat.com-foreman-proxy-1.0-1.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch

Comment 9 jaudet 2015-03-04 16:47:36 UTC
This bug has not been fixed. Tested against Version 1.9.0-develop and Satellite-6.1.0-RHEL-6-20150303.0.

Comment 11 errata-xmlrpc 2015-08-12 05:18:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592

Comment 12 sthirugn@redhat.com 2015-08-13 03:54:47 UTC
Reopening as per Comment 9.

Comment 13 Bryan Kearney 2016-03-07 15:10:00 UTC
Upstream bug assigned to bkearney

Comment 14 Bryan Kearney 2016-04-06 20:10:23 UTC
Upstream bug assigned to bkearney

Comment 15 Bryan Kearney 2016-08-10 19:04:44 UTC
Upstream bug component is API - Content

Comment 16 Bryan Kearney 2016-08-10 20:05:41 UTC
Upstream bug component is API

Comment 17 Bryan Kearney 2016-08-10 22:05:23 UTC
Upstream bug component is API - Content

Comment 18 John Mitsch 2016-12-19 20:47:57 UTC
Still a bug in 6.2.6:

[vagrant@sat-snap-rhel7 ~]$ curl -X POST -k -u admin:changeme -H "Content-Type: application/json" -d '{"organization_id": 1, "name": "hi", "max_hosts": "asldkjf", "unlimited_hosts": "true"}' https://192.168.121.113/katello/api/v2/activation_keys/ 
  {"id":1,"name":"hi","description":null,"unlimited_hosts":true,"auto_attach":true,"content_view_id":null,"environment_id":null,"usage_count":0,"user_id":3,"max_hosts":null,"release_version":null,"service_level":null,"content_overrides":[],"organization":{"name":"Default Organization","label":"Default_Organization","id":1},"created_at":"2016-12-19 20:43:26 UTC","updated_at":"2016-12-19 20:43:26 UTC","content_view":null,"environment":null,"products":null,"host_collections":[],"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}

[vagrant@sat-snap-rhel7 ~]$ rpm -qa satellite
satellite-6.2.6-2.0.el7sat.noarch


Because this field gets ignored on creation, its very low priority

Comment 19 Bryan Kearney 2016-12-19 21:09:56 UTC
Upstream bug assigned to bkearney

Comment 20 Bryan Kearney 2017-01-13 20:56:57 UTC
I do not envision this bug being addressed in the near term. I am closing this out. If you believe doing so is an issue, please feel free to re-open and provide additional business information. Thank you.


Note You need to log in before you can comment on or make changes to this bug.