Bug 2096852
| Summary: | When running subscription-manager from a script, it might hang if some arguments are not provided | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | David Hill <dhill> | |
| Component: | subscription-manager | Assignee: | Jason Jerome <jajerome> | |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> | |
| Severity: | low | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 8.2 | CC: | jsefler, jstavel, redakkan | |
| Target Milestone: | rc | Keywords: | Triaged | |
| Target Release: | 8.8 | Flags: | pm-rhel:
mirror+
|
|
| Hardware: | x86_64 | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | subscription-manager-1.28.33-1.el8 | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 2097679 (view as bug list) | Environment: | ||
| Last Closed: | 2023-05-16 09:07:12 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 2097679 | |||
The fix works as supposed: root@localhost ~]# ssh -T localhost "subscription-manager register" root@localhost's password: Registering to: subscription.rhsm.stage.redhat.com:443/subscription Error: --username is a required parameter in non-interactive mode. [root@localhost ~]# rpm -qa | grep subscription-manager subscription-manager-rhsm-certificates-1.28.33-1.el8.x86_64 subscription-manager-initial-setup-addon-1.28.33-1.el8.x86_64 dnf-plugin-subscription-manager-1.28.33-1.el8.x86_64 subscription-manager-1.28.33-1.git.0.34a04aa.el8.x86_64 subscription-manager-cockpit-1.28.33-1.git.0.34a04aa.el8.noarch python3-subscription-manager-rhsm-1.28.33-1.git.0.34a04aa.el8.x86_64 PLAY [subscription-manager raises error when user input is required in case tty is not allocated] ***
TASK [Info about version of the entitlement stack] *****************************
ok: [192.168.122.53] =>
msg: |2-
server type: This system is currently not registered.
subscription management server: 4.2.10-1
subscription management rules: 5.43
subscription-manager: 1.28.33-1.git.0.34a04aa.el8
TASK [Register in a script without TTY - without org specified] ****************
cmd: ssh -T localhost "subscription-manager register --username testuser1 --password password"
rc: 64
stdout: |-
root@localhost's password:
Registering to: archana-candlepin.usersys.redhat.com:8443/candlepin
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Error: --org is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument - org
TASK [List availabled environments in a script without TTY - without org specified] ***
cmd: ssh -T localhost "subscription-manager environments --username testuser1 --password password"
rc: 64
stdout: |-
root@localhost's password:
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Error: --org is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument - org
TASK [List availabled environments in a script without TTY - without org specified] ***
cmd: ssh -T localhost "subscription-manager environments --username testuser1 --password password"
rc: 64
stdout: |-
root@localhost's password:
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Error: --org is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument --org
TASK [List availabled environments in a script without TTY - without username specified] ***
cmd: ssh -T localhost "subscription-manager environments"
rc: 64
stdout: |-
root@localhost's password:
This operation requires user credentials
Error: --username is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument --username
TASK [Register a system with account that has more orgs available - without environment specified] ***
cmd: ssh -T localhost "subscription-manager register --username testuser1 --password password --org snowwhite"
rc: 64
stdout: |-
root@localhost's password:
Registering to: archana-candlepin.usersys.redhat.com:8443/candlepin
Hint: Organization "snowwhite" contains following environments: ArchanaEnv1, ArchanaEnv2
Error: --environments is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument --environments
TASK [Register a system with account that has more orgs available - without environment specified, without environment defined] ***
changed: [192.168.122.53]
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: Info about registering of a system appeared.
TASK [unregister a system] *****************************************************
changed: [192.168.122.53]
TASK [Register a system with account that has one org available - without environment defined] ***
changed: [192.168.122.53]
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: Info about registering of a system appeared.
PLAY [subscription-manager raises error when user input is required in case tty is not allocated] ***
TASK [Info about version of the entitlement stack] *****************************
ok: [192.168.122.53] =>
msg: |2-
server type: This system is currently not registered.
subscription management server: 4.2.10-1
subscription management rules: 5.43
subscription-manager: 1.28.33-1.git.0.34a04aa.el8
TASK [Register in a script without TTY - without org specified] ****************
cmd: ssh -T localhost "subscription-manager register --username testuser1 --password password"
rc: 64
stdout: |-
root@localhost's password:
Registering to: archana-candlepin.usersys.redhat.com:8443/candlepin
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Error: --org is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument - org
TASK [List availabled environments in a script without TTY - without org specified] ***
cmd: ssh -T localhost "subscription-manager environments --username testuser1 --password password"
rc: 64
stdout: |-
root@localhost's password:
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Error: --org is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument - org
TASK [List availabled environments in a script without TTY - without org specified] ***
cmd: ssh -T localhost "subscription-manager environments --username testuser1 --password password"
rc: 64
stdout: |-
root@localhost's password:
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Error: --org is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument --org
TASK [List availabled environments in a script without TTY - without username specified] ***
cmd: ssh -T localhost "subscription-manager environments"
rc: 64
stdout: |-
root@localhost's password:
This operation requires user credentials
Error: --username is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument --username
TASK [Register a system with account that has more orgs available - without environment specified] ***
cmd: ssh -T localhost "subscription-manager register --username testuser1 --password password --org snowwhite"
rc: 64
stdout: |-
root@localhost's password:
Registering to: archana-candlepin.usersys.redhat.com:8443/candlepin
Hint: Organization "snowwhite" contains following environments: ArchanaEnv1, ArchanaEnv2
Error: --environments is a required parameter in non-interactive mode.
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: The app informs about required argument --environments
TASK [Register a system with account that has more orgs available - without environment specified, without environment defined] ***
changed: [192.168.122.53]
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: Info about registering of a system appeared.
TASK [unregister a system] *****************************************************
changed: [192.168.122.53]
TASK [Register a system with account that has one org available - without environment defined] ***
changed: [192.168.122.53]
TASK [ansible.builtin.assert] **************************************************
ok: [192.168.122.53] => changed=false
msg: Info about registering of a system appeared.
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 (subscription-manager bug fix and enhancement update), 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/RHBA-2023:2984 |
Description of problem: When running subscription-manager from a script, it might hang if some arguments are not provided as it will prompt the user for the missing argument. When ran from scripts for automation, a failure would be much better. Perhaps the following chunk of code could be added somewhere: import sys if sys.stdin and sys.stdin.isatty(): # prompt the user for missing arguments else: # fail with an error message Version-Release number of selected component (if applicable): All How reproducible: Always Steps to Reproduce: 1. Use diskimage-builder and don't provide --environment when one is required. 2. 3. Actual results: Blocks at subscription-manager Expected results: Error message such as "--environment is missing" Additional info: