Bug 2060023

Summary: Missing hostname in tox-py39 for OSP 17
Product: Red Hat OpenStack Reporter: Szymon Datko <sdatko>
Component: python-tripleoclientAssignee: James Slagle <jslagle>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: high Docs Contact:
Priority: high    
Version: 17.0 (Wallaby)CC: hbrock, jslagle, mburns, ramishra
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-tripleoclient-16.4.1-0.20220317214636.b7b58c4.el9ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-21 12:19:32 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:

Description Szymon Datko 2022-03-02 14:31:21 UTC
Hello,

we are preparing new CI for downstream OSP 17.0 release that would run tox jobs on RHEL/CentOS 8/9.

When attempting to run py39 tests with tox, I observe the following failures:
```
2022-03-01 14:12:37.942171 | container | tripleoclient.tests.v1.undercloud.test_install_upgrade.TestUndercloudInstall.test_undercloud_install_with_heat_net_conf_over
2022-03-01 14:12:37.942177 | container | ----------------------------------------------------------------------------------------------------------------------------
2022-03-01 14:12:37.942183 | container |
2022-03-01 14:12:37.942189 | container | Captured traceback:
2022-03-01 14:12:37.942196 | container | ~~~~~~~~~~~~~~~~~~~
2022-03-01 14:12:37.942202 | container |     Traceback (most recent call last):
2022-03-01 14:12:37.942208 | container |
2022-03-01 14:12:37.942214 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/.tox/py39/lib/python3.9/site-packages/mock/mock.py", line 1346, in patched
2022-03-01 14:12:37.942220 | container |     return func(*newargs, **newkeywargs)
2022-03-01 14:12:37.942226 | container |
2022-03-01 14:12:37.942233 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/tripleoclient/tests/v1/undercloud/test_install_upgrade.py", line 281, in test_undercloud_install_with_heat_net_conf_over
2022-03-01 14:12:37.942239 | container |     self.cmd.take_action(parsed_args)
2022-03-01 14:12:37.942245 | container |
2022-03-01 14:12:37.942251 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/tripleoclient/v1/undercloud.py", line 147, in take_action
2022-03-01 14:12:37.942257 | container |     cmd = undercloud_config.prepare_undercloud_deploy(
2022-03-01 14:12:37.942263 | container |
2022-03-01 14:12:37.942269 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/tripleoclient/v1/undercloud_config.py", line 520, in prepare_undercloud_deploy
2022-03-01 14:12:37.942276 | container |     local_registry_name = '.'.join([utils.get_short_hostname(),
2022-03-01 14:12:37.942282 | container |
2022-03-01 14:12:37.942288 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/tripleoclient/utils.py", line 2054, in get_short_hostname
2022-03-01 14:12:37.942295 | container |     p = subprocess.Popen(["hostname", "-s"], stdout=subprocess.PIPE,
2022-03-01 14:12:37.942301 | container |
2022-03-01 14:12:37.942307 | container |       File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
2022-03-01 14:12:37.942313 | container |     self._execute_child(args, executable, preexec_fn, close_fds,
2022-03-01 14:12:37.942320 | container |
2022-03-01 14:12:37.942327 | container |       File "/usr/lib64/python3.9/subprocess.py", line 1821, in _execute_child
2022-03-01 14:12:37.942333 | container |     raise child_exception_type(errno_num, err_msg, err_filename)
2022-03-01 14:12:37.942339 | container |
2022-03-01 14:12:37.942346 | container |     FileNotFoundError: [Errno 2] No such file or directory: 'hostname'
```

It appears that by default the RHEL 8/9 has no `hostname` command. Should this mentioned part of code be adjusted for downstream purpose? Or the traditional hostname utility shall be installed as some package mentioned in bindep.txt?

Comment 2 Kevin Carter 2022-03-02 16:59:04 UTC
The hostname command is present in C9-Stream, I suspect this is just a matter of a missing package. Please add the hostname package to the build environment. We may also need/want to add the package to the tripleoclient spec? 

hostname-3.23-6.el9.x86_64 : Utility to set/show the host name or domain name
Repo        : baseos
Matched from:
Provide    : hostname = 3.23-6.el9


This should be added to the required bindep.

Comment 3 Szymon Datko 2022-03-08 12:58:38 UTC
Proposed the upstream patch: https://review.opendev.org/c/openstack/python-tripleoclient/+/832628

Comment 6 Szymon Datko 2022-03-15 10:19:36 UTC
Upstream change was merged to master.

I continue with cherry-picks.
Note: in upstream I found only stable/wallaby, no stable/xena – is it expected/missing?
( https://opendev.org/openstack/python-tripleoclient )

Comment 7 James Slagle 2022-03-16 12:11:37 UTC
(In reply to Szymon Datko from comment #6)
> Upstream change was merged to master.
> 
> I continue with cherry-picks.
> Note: in upstream I found only stable/wallaby, no stable/xena – is it
> expected/missing?
> ( https://opendev.org/openstack/python-tripleoclient )

yes, there is only stable/wallaby.

Comment 8 Szymon Datko 2022-03-16 17:27:10 UTC
Both upstream changes are merged.

Downstream cherry-pick here: https://code.engineering.redhat.com/gerrit/c/python-tripleoclient/+/318567



There is only one failure now due to the downstream jobs configuration we will have to resolve as a separate task:

```
2022-03-16 16:53:10.246498 | container | ==============================
2022-03-16 16:53:10.246528 | container | Failed 1 tests - output below:
2022-03-16 16:53:10.246538 | container | ==============================
2022-03-16 16:53:10.246544 | container |
2022-03-16 16:53:10.246550 | container | tripleoclient.tests.v1.overcloud_external_update.test_overcloud_external_update.TestOvercloudExternalUpdateRun.test_update_with_refresh
2022-03-16 16:53:10.246556 | container | ---------------------------------------------------------------------------------------------------------------------------------------
2022-03-16 16:53:10.246562 | container |
2022-03-16 16:53:10.246568 | container | Captured traceback:
2022-03-16 16:53:10.246574 | container | ~~~~~~~~~~~~~~~~~~~
2022-03-16 16:53:10.246579 | container |     Traceback (most recent call last):
2022-03-16 16:53:10.246585 | container |
2022-03-16 16:53:10.246591 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/.tox/py39/lib/python3.9/site-packages/mock/mock.py", line 1346, in patched
2022-03-16 16:53:10.246598 | container |     return func(*newargs, **newkeywargs)
2022-03-16 16:53:10.246603 | container |
2022-03-16 16:53:10.246609 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/tripleoclient/tests/v1/overcloud_external_update/test_overcloud_external_update.py", line 123, in test_update_with_refresh
2022-03-16 16:53:10.246616 | container |     self.cmd.take_action(parsed_args)
2022-03-16 16:53:10.246622 | container |
2022-03-16 16:53:10.246627 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/tripleoclient/v1/overcloud_external_update.py", line 131, in take_action
2022-03-16 16:53:10.246633 | container |     oooutils.ensure_run_as_normal_user()
2022-03-16 16:53:10.246638 | container |
2022-03-16 16:53:10.246644 | container |       File "/root/src/code.engineering.redhat.com/python-tripleoclient/tripleoclient/utils.py", line 1272, in ensure_run_as_normal_user
2022-03-16 16:53:10.246650 | container |     raise exceptions.RootUserExecution(_(
2022-03-16 16:53:10.246655 | container |
2022-03-16 16:53:10.246661 | container |     tripleoclient.exceptions.RootUserExecution: This command cannot run under root user. Switch to a normal user.
```

Comment 11 David Rosenfeld 2022-07-01 12:20:58 UTC
Checked with submitter and its fixed. Moving to verified.

Comment 16 errata-xmlrpc 2022-09-21 12:19:32 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 (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), 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/RHEA-2022:6543