Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2271597

Summary: Undercloud deployment with custom deployment_user fails when primary group is different to the user name
Product: Red Hat OpenStack Reporter: Eric Nothen <enothen>
Component: python-tripleoclientAssignee: Rabi Mishra <ramishra>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: high Docs Contact:
Priority: high    
Version: 17.1 (Wallaby)CC: jpretori, jslagle, mariel, mburns, pgrist, pkomarov, ramishra
Target Milestone: z3Keywords: Triaged
Target Release: 17.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-tripleoclient-16.5.1-17.1.20230927000830.el9ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-05-22 20:41:11 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 Eric Nothen 2024-03-26 13:41:49 UTC
Description of problem:
Unable to deploy undercloud with a custom user and group

Version-Release number of selected component (if applicable):
17.1.2

How reproducible:
always reproducible

Steps to Reproduce:
1. Create a custom user with a primary group different to the user name
2. Run preparation steps (section #3) [0] but specifying the custom user instead of the stack user whenever user "stack" is mentioned
3. Configure undercloud.conf to use the custom deployment user

~~~
[custom_user@rhosp171uc ~]$ egrep -v "^$|^#" undercloud.conf  | grep -B1 deployment_user
[DEFAULT]
deployment_user = custom_user
[custom_user@rhosp171uc ~]$ 
[custom_user@rhosp171uc ~]$ id
uid=1001(custom_user) gid=100(users) groups=100(users) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[custom_user@rhosp171uc ~]$ 
~~~

Actual results:
Deployment fails:

~~~
[custom_user@rhosp171uc ~]$ openstack undercloud install
Stack not found: None. No data found in neither neutron or heat. Only the undercloud will be added to the inventory.
Running: sudo --preserve-env openstack tripleo deploy --standalone --standalone-role Undercloud --stack undercloud --local-domain=localdomain --local-ip=192.168.24.1/24 --templates=/usr/share/openstack-tripleo-heat-templates/ --networks-file=/usr/share/openstack-tripleo-heat-templates/network_data_undercloud.yaml --heat-native -e /usr/share/openstack-tripleo-heat-templates/environments/undercloud.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/use-dns-for-vips.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic-inspector.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-remove-novajoin.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/public-tls-undercloud.yaml --public-virtual-ip 192.168.24.2 --control-virtual-ip 192.168.24.3 -e /usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-endpoints-public-ip.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-haproxy.yaml --deployment-user custom_user --output-dir=/home/custom_user/tripleo-deploy/undercloud --cleanup -e /home/custom_user/tripleo-deploy/undercloud/tripleo-config-generated-env-files/undercloud_parameters.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/tripleo-validations.yaml --log-file=install-undercloud.log -e /usr/share/openstack-tripleo-heat-templates/undercloud-stack-vstate-dropin.yaml
The heat stack undercloud action is CREATE
Install artifact is located at /home/custom_user/tripleo-deploy/undercloud/undercloud-install-20240326132940.tar.bzip2
Exception: 'Deploy' object has no attribute 'heat_launch'
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/tripleoclient/v1/tripleo_deploy.py", line 1271, in _standalone_deploy
    orchestration_client = self._launch_heat(parsed_args, output_dir)
  File "/usr/lib/python3.9/site-packages/tripleoclient/v1/tripleo_deploy.py", line 485, in _launch_heat
    self.heat_launch = heat_launcher.HeatNativeLauncher(
  File "/usr/lib/python3.9/site-packages/tripleoclient/heat_launcher.py", line 445, in __init__
    super(HeatNativeLauncher, self).__init__(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/tripleoclient/heat_launcher.py", line 208, in __init__
    gid = int(self.get_heat_gid())
  File "/usr/lib/python3.9/site-packages/tripleoclient/heat_launcher.py", line 316, in get_heat_gid
    return grp.getgrnam(self.user).gr_gid
KeyError: "getgrnam(): name not found: 'custom_user'"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/tripleoclient/v1/tripleo_deploy.py", line 1455, in take_action
    self._standalone_deploy(parsed_args)
  File "/usr/lib/python3.9/site-packages/tripleoclient/v1/tripleo_deploy.py", line 1409, in _standalone_deploy
    self.heat_launch.install_dir
AttributeError: 'Deploy' object has no attribute 'heat_launch'
None
'Deploy' object has no attribute 'heat_launch'

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

An error has occured while deploying the Undercloud.

See the previous output for details about what went wrong.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Command '['sudo', '--preserve-env', 'openstack', 'tripleo', 'deploy', '--standalone', '--standalone-role', 'Undercloud', '--stack', 'undercloud', '--local-domain=localdomain', '--local-ip=192.168.24.1/24', '--templates=/usr/share/openstack-tripleo-heat-templates/', '--networks-file=/usr/share/openstack-tripleo-heat-templates/network_data_undercloud.yaml', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/undercloud.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/use-dns-for-vips.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/ironic.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/ironic-inspector.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-remove-novajoin.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/public-tls-undercloud.yaml', '--public-virtual-ip', '192.168.24.2', '--control-virtual-ip', '192.168.24.3', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-haproxy.yaml', '--deployment-user', 'custom_user', '--output-dir=/home/custom_user/tripleo-deploy/undercloud', '--cleanup', '-e', '/home/custom_user/tripleo-deploy/undercloud/tripleo-config-generated-env-files/undercloud_parameters.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/tripleo-validations.yaml', '--log-file=install-undercloud.log', '-e', '/usr/share/openstack-tripleo-heat-templates/undercloud-stack-vstate-dropin.yaml']' returned non-zero exit status 1.
Command '['sudo', '--preserve-env', 'openstack', 'tripleo', 'deploy', '--standalone', '--standalone-role', 'Undercloud', '--stack', 'undercloud', '--local-domain=localdomain', '--local-ip=192.168.24.1/24', '--templates=/usr/share/openstack-tripleo-heat-templates/', '--networks-file=/usr/share/openstack-tripleo-heat-templates/network_data_undercloud.yaml', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/undercloud.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/use-dns-for-vips.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/ironic.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/ironic-inspector.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-remove-novajoin.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/public-tls-undercloud.yaml', '--public-virtual-ip', '192.168.24.2', '--control-virtual-ip', '192.168.24.3', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-haproxy.yaml', '--deployment-user', 'custom_user', '--output-dir=/home/custom_user/tripleo-deploy/undercloud', '--cleanup', '-e', '/home/custom_user/tripleo-deploy/undercloud/tripleo-config-generated-env-files/undercloud_parameters.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/tripleo-validations.yaml', '--log-file=install-undercloud.log', '-e', '/usr/share/openstack-tripleo-heat-templates/undercloud-stack-vstate-dropin.yaml']' returned non-zero exit status 1.
[custom_user@rhosp171uc ~]$ 
~~~

Expected results:
Installation works with a custom user regardless of its primary group

Additional info:

When the custom user has a primary group matching the user name, installation works:

~~~
[anotheruser@rhosp171uc ~]$ id
uid=1002(anotheruser) gid=1002(anotheruser) groups=1002(anotheruser) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[anotheruser@rhosp171uc ~]$ 
[anotheruser@rhosp171uc ~]$ egrep -v "^$|^#" undercloud.conf  | grep -B1 deployment_user
[DEFAULT]
deployment_user = anotheruser
[anotheruser@rhosp171uc ~]$ 
[anotheruser@rhosp171uc ~]$ openstack undercloud install
Stack not found: None. No data found in neither neutron or heat. Only the undercloud will be added to the inventory.
Running: sudo --preserve-env openstack tripleo deploy --standalone --standalone-role Undercloud --stack undercloud --local-domain=localdomain --local-ip=192.168.24.1/24 --templates=/usr/share/openstack-tripleo-heat-templates/ --networks-file=/usr/share/openstack-tripleo-heat-templates/network_data_undercloud.yaml --heat-native -e /usr/share/openstack-tripleo-heat-templates/environments/undercloud.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/use-dns-for-vips.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic-inspector.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-remove-novajoin.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/public-tls-undercloud.yaml --public-virtual-ip 192.168.24.2 --control-virtual-ip 192.168.24.3 -e /usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-endpoints-public-ip.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-haproxy.yaml --deployment-user anotheruser --output-dir=/home/anotheruser/tripleo-deploy/undercloud --cleanup -e /home/anotheruser/tripleo-deploy/undercloud/tripleo-config-generated-env-files/undercloud_parameters.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/tripleo-validations.yaml --log-file=install-undercloud.log -e /usr/share/openstack-tripleo-heat-templates/undercloud-stack-vstate-dropin.yaml
The heat stack undercloud action is CREATE
2024-03-26 09:40:00.111 4644 INFO migrate.versioning.api [-] 72 -> 73... 
2024-03-26 09:40:00.129 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.129 4644 INFO migrate.versioning.api [-] 73 -> 74... 
2024-03-26 09:40:00.131 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.131 4644 INFO migrate.versioning.api [-] 74 -> 75... 
2024-03-26 09:40:00.132 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.132 4644 INFO migrate.versioning.api [-] 75 -> 76... 
2024-03-26 09:40:00.134 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.135 4644 INFO migrate.versioning.api [-] 76 -> 77... 
2024-03-26 09:40:00.136 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.136 4644 INFO migrate.versioning.api [-] 77 -> 78... 
2024-03-26 09:40:00.137 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.137 4644 INFO migrate.versioning.api [-] 78 -> 79... 
2024-03-26 09:40:00.154 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.155 4644 INFO migrate.versioning.api [-] 79 -> 80... 
2024-03-26 09:40:00.167 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.167 4644 INFO migrate.versioning.api [-] 80 -> 81... 
2024-03-26 09:40:00.169 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.169 4644 INFO migrate.versioning.api [-] 81 -> 82... 
2024-03-26 09:40:00.170 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.170 4644 INFO migrate.versioning.api [-] 82 -> 83... 
2024-03-26 09:40:00.172 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.172 4644 INFO migrate.versioning.api [-] 83 -> 84... 
2024-03-26 09:40:00.174 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.174 4644 INFO migrate.versioning.api [-] 84 -> 85... 
2024-03-26 09:40:00.176 4644 INFO migrate.versioning.api [-] done
2024-03-26 09:40:00.176 4644 INFO migrate.versioning.api [-] 85 -> 86... 
2024-03-26 09:40:00.192 4644 INFO migrate.versioning.api [-] done
...
~~~

Comment 1 Eric Nothen 2024-03-26 14:15:19 UTC
Also, it looks like the group matching the name does not even need to be assigned to the deployment_user, it only needs to exist. Maybe this fails later on, but at least for now it's running:

~~~
[custom_user@rhosp171uc ~]$ id
uid=1001(custom_user) gid=100(users) groups=100(users) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[custom_user@rhosp171uc ~]$ 
[custom_user@rhosp171uc ~]$ sudo groupadd custom_user
[custom_user@rhosp171uc ~]$ 
[custom_user@rhosp171uc ~]$ openstack undercloud install
Stack not found: None. No data found in neither neutron or heat. Only the undercloud will be added to the inventory.
Running: sudo --preserve-env openstack tripleo deploy --standalone --standalone-role Undercloud --stack undercloud --local-domain=localdomain --local-ip=192.168.24.1/24 --templates=/usr/share/openstack-tripleo-heat-templates/ --networks-file=/usr/share/openstack-tripleo-heat-templates/network_data_undercloud.yaml --heat-native -e /usr/share/openstack-tripleo-heat-templates/environments/undercloud.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/use-dns-for-vips.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic-inspector.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-remove-novajoin.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/public-tls-undercloud.yaml --public-virtual-ip 192.168.24.2 --control-virtual-ip 192.168.24.3 -e /usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-endpoints-public-ip.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/services/undercloud-haproxy.yaml --deployment-user custom_user --output-dir=/home/custom_user/tripleo-deploy/undercloud --cleanup -e /home/custom_user/tripleo-deploy/undercloud/tripleo-config-generated-env-files/undercloud_parameters.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/tripleo-validations.yaml --log-file=install-undercloud.log -e /usr/share/openstack-tripleo-heat-templates/undercloud-stack-vstate-dropin.yaml
The heat stack undercloud action is CREATE
2024-03-26 10:11:41.787 4352 INFO migrate.versioning.api [-] 72 -> 73... 
2024-03-26 10:11:41.805 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.806 4352 INFO migrate.versioning.api [-] 73 -> 74... 
2024-03-26 10:11:41.807 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.807 4352 INFO migrate.versioning.api [-] 74 -> 75... 
2024-03-26 10:11:41.809 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.809 4352 INFO migrate.versioning.api [-] 75 -> 76... 
2024-03-26 10:11:41.810 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.811 4352 INFO migrate.versioning.api [-] 76 -> 77... 
2024-03-26 10:11:41.812 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.812 4352 INFO migrate.versioning.api [-] 77 -> 78... 
2024-03-26 10:11:41.813 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.813 4352 INFO migrate.versioning.api [-] 78 -> 79... 
2024-03-26 10:11:41.831 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.831 4352 INFO migrate.versioning.api [-] 79 -> 80... 
2024-03-26 10:11:41.845 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.845 4352 INFO migrate.versioning.api [-] 80 -> 81... 
2024-03-26 10:11:41.847 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.847 4352 INFO migrate.versioning.api [-] 81 -> 82... 
2024-03-26 10:11:41.849 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.849 4352 INFO migrate.versioning.api [-] 82 -> 83... 
2024-03-26 10:11:41.851 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.851 4352 INFO migrate.versioning.api [-] 83 -> 84... 
2024-03-26 10:11:41.853 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.853 4352 INFO migrate.versioning.api [-] 84 -> 85... 
2024-03-26 10:11:41.855 4352 INFO migrate.versioning.api [-] done
2024-03-26 10:11:41.855 4352 INFO migrate.versioning.api [-] 85 -> 86... 
2024-03-26 10:11:41.872 4352 INFO migrate.versioning.api [-] done
...
~~~

Comment 3 Paul Grist 2024-04-10 11:47:23 UTC
rhos trac approved for z3 - https://issues.redhat.com/browse/OSP-31798 and DFG to verify, please open a BZ/Jira to track any automated test needs for z4

Comment 14 errata-xmlrpc 2024-05-22 20:41:11 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 (Red Hat OpenStack Platform 17.1.3 bug fix and enhancement advisory), 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-2024:2741