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

Redhat_subscription fails when quantity isn't given on a physical server. #66478

Closed
AdamMorris23 opened this issue Jan 14, 2020 · 3 comments · Fixed by #66807
Closed

Redhat_subscription fails when quantity isn't given on a physical server. #66478

AdamMorris23 opened this issue Jan 14, 2020 · 3 comments · Fixed by #66807
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. packaging Packaging category support:community This issue/PR relates to code supported by the Ansible community.

Comments

@AdamMorris23
Copy link

SUMMARY

Using the redhat_subscription module with pool_ids and no quantities on a physical server causes the quantity to be forced to 1. This results in a warning on stdout from redhat_subscription and a return code of 1. This causes the action to be marked as FAILED although subscription_manager does the right thing.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

redhat_subscription

ANSIBLE VERSION
ansible 2.8.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/morrisa/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u'/etc/ansible/roles', u'/usr/share/ansible/roles']
OS / ENVIRONMENT

Tested with Ansible 2.9, not tested with the development version yet but the issue is still there in the code. Target OS Version is RedHat Enterprise Linux 7.6 on a two socket physical server.

STEPS TO REPRODUCE

Using a physical server with two sockets execute the equivalent of the yaml below.

- name: Same as above but subscribe to a specific pool by ID.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids: 0123456789abcdef0123456789abcdef
EXPECTED RESULTS

I expect the system to be subscribed to a given pool.

ACTUAL RESULTS

This play fails with a warning on stdout that Quantity needs to be a multiple of 2 and a return code of 1. Subscription-manager does the right thing but the return code causes Ansible to choke.

In the main code if pool_ids is provided without a quantity then it is set to 1. This is not valid for a two socket physical server.


@ansibot
Copy link
Contributor

ansibot commented Jan 14, 2020

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jan 14, 2020

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. packaging Packaging category support:community This issue/PR relates to code supported by the Ansible community. labels Jan 14, 2020
@jirihnidek
Copy link
Contributor

When quantity is not specified, then default value 1 is used:

This works in most cases, but not in case described in this issue. When special type of product is used, then it is required to attach at least quantity e.g. 2 on physical server. When no quantity is specified, then subscription-manager is able to attach correct minimal quantity as it is demonstrated in following example:

[root@localhost ~]# subscription-manager attach --pool ff8080816fd8736f016fd87669c702b5 --quantity=1
Subscription "Awesome OS Instance Based (Standard Support)" must be attached using a quantity evenly divisible by 2
[root@localhost ~]# subscription-manager attach --pool ff8080816fd8736f016fd87669c702b5
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)

When quantity is not specified, then I propose to set quantity to None and not set --quantity option here:

args = [SUBMAN_CMD, 'attach', '--pool', pool_id, '--quantity', quantity]

@cnsnyder Thoughts?

jirihnidek added a commit to jirihnidek/ansible that referenced this issue Jan 27, 2020
* Bug fix for: ansible#66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.
jirihnidek added a commit to jirihnidek/ansible that referenced this issue Jan 27, 2020
* Bug fix for: ansible#66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.
jirihnidek added a commit to jirihnidek/ansible that referenced this issue Jan 28, 2020
* Bug fix for: ansible#66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.
samdoran pushed a commit that referenced this issue Jan 29, 2020
* Fixes #66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.
jirihnidek added a commit to jirihnidek/ansible that referenced this issue Jan 30, 2020
…66807)

* Fixes ansible#66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.

(cherry picked from commit 6f1bb37)
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Jan 30, 2020
nitzmahone pushed a commit that referenced this issue Feb 10, 2020
…66933)

* Fixes #66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.

(cherry picked from commit 6f1bb37)
@ansible ansible locked and limited conversation to collaborators Feb 26, 2020
ruozeng-w pushed a commit to ruozeng-w/ansible that referenced this issue Apr 18, 2020
…66807)

* Fixes ansible#66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. packaging Packaging category support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants