ansible-devops icon indicating copy to clipboard operation
ansible-devops copied to clipboard

ibm/mas_devops/plugins/action/apply_subscription.py

Open jalepisto opened this issue 3 months ago • 3 comments

Collection version

ibm.mas_devops 29.5.0

Environment information

ansible [core 2.15.9]
  config file = None
  configured module search path = ['/home/admnexer/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/admnexer/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/admnexer/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/admnexer/.local/bin/ansible
  python version = 3.9.21 (main, Dec  5 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True
[admnexer@bastion mas_devops]$ python --version
Python 3.9.21
[admnexer@bastion mas_devops]$ python -m pip list
Package               Version
--------------------- --------
ansible               8.7.0
ansible-core          2.15.9
cachetools            5.3.3
certifi               2024.2.2
cffi                  1.16.0
chardet               4.0.0
cockpit               323.1
cryptography          42.0.5
dasbus                1.4
dbus-python           1.2.18
decorator             4.4.2
distro                1.5.0
dnspython             2.6.1
ethtool               0.15
file-magic            0.4.0
google-auth           2.28.1
gpg                   1.15.1
idna                  2.10
importlib-resources   5.0.7
iniparse              0.4
Jinja2                3.1.3
jinja2-base64-filters 0.1.4
jmespath              1.0.1
junit-xml             1.9
kubeconfig            1.1.1
kubernetes            29.0.0
libcomps              0.1.18
lxml                  4.6.5
MarkupSafe            2.1.5
mas-devops            2.0.0
nftables              0.1
oauthlib              3.2.2
openshift             0.13.2
packaging             23.2
perf                  0.1
pexpect               4.8.0
pip                   21.3.1
psutil                5.8.0
ptyprocess            0.6.0
pyasn1                0.5.1
pyasn1-modules        0.3.0
pycparser             2.21
PyGObject             3.40.1
pyinotify             0.9.6
pymongo               4.7.2
PySocks               1.7.1
python-dateutil       2.8.1
python-linux-procfs   0.7.3
python-string-utils   1.0.0
pyudev                0.22.0
PyYAML                5.4.1
requests              2.25.1
requests-oauthlib     1.3.1
resolvelib            1.0.1
rpm                   4.16.1.3
rsa                   4.9
ruamel.yaml           0.18.6
ruamel.yaml.clib      0.2.8
selinux               3.6
sepolicy              3.6
setools               4.4.4
setroubleshoot        3.3.32
setuptools            53.0.0
six                   1.15.0
sos                   4.8.2
subscription-manager  1.29.42
systemd-python        234
urllib3               1.26.5
websocket-client      1.7.0
xmljson               0.2.1

What happened?

apply_subscription.py fails always, no matter from which script its called from. Script is giving 8 arguments to applySubscription and it says 7 is max. Output here from aiservice

Relevant log output

TASK [ibm.mas_devops.aiservice_odh : Install Openshift authorino Operator] **************************************************************************************************
task path: /home/admnexer/.ansible/collections/ansible_collections/ibm/mas_devops/roles/aiservice_odh/tasks/authorino-operator.yml:4
The full traceback is:
Traceback (most recent call last):
  File "/home/admnexer/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 165, in run
    res = self._execute()
  File "/home/admnexer/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 656, in _execute
    result = self._handler.run(task_vars=vars_copy)
  File "/home/admnexer/.ansible/collections/ansible_collections/ibm/mas_devops/plugins/action/apply_subscription.py", line 56, in run
    subscription = applySubscription(dynClient, namespace, packageName, packageChannel, catalogSource, catalogSourceNamespace, config, installMode)
TypeError: applySubscription() takes from 3 to 7 positional arguments but 8 were given
fatal: [localhost]: FAILED! => {
    "msg": "Unexpected failure during module execution: applySubscription() takes from 3 to 7 positional arguments but 8 were given",
    "stdout": ""

jalepisto avatar Sep 17 '25 06:09 jalepisto

Looking at version 27.0.0 that script has 7 arguments

   try:
        subscription = applySubscription(dynClient, namespace, packageName, packageChannel, catalogSource, catalogSourceNamespace, config)

installmode has been added ?

jalepisto avatar Sep 17 '25 06:09 jalepisto

Its still there with 29.6.0 TASK [ibm.mas_devops.cert_manager : install : Create Red Hat Certificate Manager Subscription] *************************************************** task path: /home/admnexer/.ansible/collections/ansible_collections/ibm/mas_devops/roles/cert_manager/tasks/provider/redhat/install.yml:69 The full traceback is: Traceback (most recent call last): File "/home/admnexer/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 165, in run res = self._execute() File "/home/admnexer/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 656, in _execute result = self._handler.run(task_vars=vars_copy) File "/home/admnexer/.ansible/collections/ansible_collections/ibm/mas_devops/plugins/action/apply_subscription.py", line 56, in run subscription = applySubscription(dynClient, namespace, packageName, packageChannel, catalogSource, catalogSourceNamespace, config, installMode) TypeError: applySubscription() takes from 3 to 7 positional arguments but 8 were given fatal: [localhost]: FAILED! => { "msg": "Unexpected failure during module execution: applySubscription() takes from 3 to 7 positional arguments but 8 were given", "stdout": "" }

jalepisto avatar Sep 24 '25 09:09 jalepisto

Your copy of the python package ansible (e.g. pip install ansible) is probably pinned to 8.7, or mas-devops is pinned to 2.0. The latest version is in the double digits (we pin to 11.8 and 5.2; may not be latest). The applySubscription function signature has changed 2.0.

Bump your ansible/mas-devops package versions.

faangbait avatar Oct 15 '25 00:10 faangbait

I will look to add a minimum version check into the collection to help catch cases like this where user is maintaining their own execution environment and has out of date dependencies.

durera avatar Nov 26 '25 10:11 durera