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_manifest does not properly report wrong username/password #1497

Closed
ikke-t opened this issue Oct 11, 2022 · 2 comments · Fixed by #1498
Closed

redhat_manifest does not properly report wrong username/password #1497

ikke-t opened this issue Oct 11, 2022 · 2 comments · Fixed by #1498

Comments

@ikke-t
Copy link

ikke-t commented Oct 11, 2022

SUMMARY

I tried to add subs to manifest, but end up having ansible failing.

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
▶ ansible --version
ansible [core 2.13.3]
  config file = /home/itengval/src/redhatnordicssa/cool-lab/ansible.cfg
  configured module search path = ['/home/itengval/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/itengval/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/itengval/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/itengval/.local/bin/ansible
  python version = 3.10.7 (main, Sep  7 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-1)]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
  - name: redhat.satellite
    version: 3.7.0

https://github.com/RedHatNordicsSA/cool-lab/blob/ab8ec7df1b408a78337b9d0a819285848207f24b/collections/requirements.yml

KATELLO/FOREMAN VERSION
foreman-3.1.1.23-2.el8sat.noarch
STEPS TO REPRODUCE
    - name: Attach subs to manifest
      redhat.satellite.redhat_manifest:
        name: "rh-satellite-01.cool.lab"
        username: "{{ satellite_username }}"
        password: "{{ satellite_password }}"
        validate_certs: "{{ satellite_validate_certs }}"
        state: present
        pool_state: present
        pool_id: "{{ item }}"
      with_items:
        - 8a82c49480862395018097e532dd5f8c
        - 8a82c49480862395018097e5b4be5fda
        - 8a82c49480862395018097e5b5365fdc
        - 8a82c58b80862385018097e5e58a2bf9
        - 8a82c58b80862385018097e5e5c02bfb
        - 8a82c65580863028018097e76c09027d
        - 8a82c68d80862c73018097e643521cad
 

https://github.com/RedHatNordicsSA/cool-lab/blob/ab8ec7df1b408a78337b9d0a819285848207f24b/satellite-install.yml

EXPECTED RESULTS

Have manifest with subs in Satellite.

ACTUAL RESULTS
 ansible-playbook -i hosts -u root -e @../private-lab/secrets.yml -e satellite_manifest_refresh=false satellite-install.yml -vvv

->
...
<10.128.1.17> ESTABLISH SSH CONNECTION FOR USER: root
<10.128.1.17> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/itengval/.ansible/cp/f80b17a361"' 10.128.1.17 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<10.128.1.17> (0, b'/root\n', b'')
<10.128.1.17> ESTABLISH SSH CONNECTION FOR USER: root
<10.128.1.17> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/itengval/.ansible/cp/f80b17a361"' 10.128.1.17 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298 `" && echo ansible-tmp-1665488287.0971892-160156-48110693421298="` echo /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298 `" ) && sleep 0'"'"''
<10.128.1.17> (0, b'ansible-tmp-1665488287.0971892-160156-48110693421298=/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298\n', b'')
Using module file /home/itengval/src/redhatnordicssa/cool-lab/collections/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py
<10.128.1.17> PUT /home/itengval/.ansible/tmp/ansible-local-159975nmwc86ll/tmpifdm7ulu TO /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py
<10.128.1.17> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/itengval/.ansible/cp/f80b17a361"' '[10.128.1.17]'
<10.128.1.17> (0, b'sftp> put /home/itengval/.ansible/tmp/ansible-local-159975nmwc86ll/tmpifdm7ulu /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py\n', b'')
<10.128.1.17> ESTABLISH SSH CONNECTION FOR USER: root
<10.128.1.17> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/itengval/.ansible/cp/f80b17a361"' 10.128.1.17 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/ /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py && sleep 0'"'"''
<10.128.1.17> (0, b'', b'')
<10.128.1.17> ESTABLISH SSH CONNECTION FOR USER: root
<10.128.1.17> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/itengval/.ansible/cp/f80b17a361"' -tt 10.128.1.17 '/bin/sh -c '"'"'/usr/libexec/platform-python /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py && sleep 0'"'"''
<10.128.1.17> (1, b'Traceback (most recent call last):\r\n  File "/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py", line 107, in <module>\r\n    _ansiballz_main()\r\n  File "/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File "/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py", line 48, in invoke_module\r\n    run_name=\'__main__\', alter_sys=True)\r\n  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code\r\n    mod_name, mod_spec, pkg_name, script_name)\r\n  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File "/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py", line 329, in <module>\r\n  File "/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py", line 313, in main\r\n  File "/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py", line 213, in get_owner\r\n  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads\r\n    return _default_decoder.decode(s)\r\n  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode\r\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\r\n  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode\r\n    raise JSONDecodeError("Expecting value", s, err.value) from None\r\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\r\n', b'Shared connection to 10.128.1.17 closed.\r\n')
<10.128.1.17> Failed to connect to the host via ssh: Shared connection to 10.128.1.17 closed.
<10.128.1.17> ESTABLISH SSH CONNECTION FOR USER: root
<10.128.1.17> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/itengval/.ansible/cp/f80b17a361"' 10.128.1.17 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/ > /dev/null 2>&1 && sleep 0'"'"''
<10.128.1.17> (0, b'', b'')
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py", line 107, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py", line 48, in invoke_module
    run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py", line 329, in <module>
  File "/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py", line 313, in main
  File "/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py", line 213, in get_owner
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
failed: [rh-satellite-01.cool.lab] (item=8a82c68d80862c73018097e643521cad) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": "8a82c68d80862c73018097e643521cad",
    "module_stderr": "Shared connection to 10.128.1.17 closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1665488287.0971892-160156-48110693421298/AnsiballZ_redhat_manifest.py\", line 48, in invoke_module\r\n    run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\r\n    mod_name, mod_spec, pkg_name, script_name)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py\", line 329, in <module>\r\n  File \"/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py\", line 313, in main\r\n  File \"/tmp/ansible_redhat.satellite.redhat_manifest_payload_04vsswg1/ansible_redhat.satellite.redhat_manifest_payload.zip/ansible_collections/redhat/satellite/plugins/modules/redhat_manifest.py\", line 213, in get_owner\r\n  File \"/usr/lib64/python3.6/json/__init__.py\", line 354, in loads\r\n    return _default_decoder.decode(s)\r\n  File \"/usr/lib64/python3.6/json/decoder.py\", line 339, in decode\r\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\r\n  File \"/usr/lib64/python3.6/json/decoder.py\", line 357, in raw_decode\r\n    raise JSONDecodeError(\"Expecting value\", s, err.value) from None\r\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
@ikke-t
Copy link
Author

ikke-t commented Oct 12, 2022

I think this is because of the transition described here: https://access.redhat.com/articles/transition_of_subscription_services_to_the_hybrid_cloud_console

So manifest handling is moving from access.redhat.com to console.redhat.com. While at it, the new console doesn't have the subscription handling for manifests. It also points to guide which doesn't talk about subscriptions at all.

the subs management guide console points to does not mention anything about adding subs to manifest.

The above guide is not guiding how to add subs to manifest. In the chat's I learned it could be done the old way via access.redhat.com, but it's moving to satellite. At least it won't work with this ansible module any longer. Perhaps this module should be changed to work against satellite API instead for the task?

Perhaps splitting this module into two:

  1. one that creates manifest into console.redhat.com, and
  2. second one that talks to satellite api to attach subs to manifest.

Another option is somehow to guide this to talk to old api, and use it as long as it works, but is there point if the functionality is moving away from there?

@evgeni evgeni changed the title redhat_manifest fails to add subscriptions to manifest redhat_manifest does not properly report wrong username/password Oct 12, 2022
@evgeni
Copy link
Member

evgeni commented Oct 12, 2022

debugged this with @ikke-t offline, turned out the username/password was wrong and our reporting here sucks, patch incoming :)

@evgeni evgeni linked a pull request Oct 12, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants