Bug 1244235

Summary: openstack undercloud install allows root, then fails
Product: Red Hat OpenStack Reporter: Steven Hardy <shardy>
Component: rhosp-directorAssignee: chris alfonso <calfonso>
Status: CLOSED DUPLICATE QA Contact: yeylon <yeylon>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: hbrock, mburns, rhel-osp-director-maint, srevivo
Target Milestone: ---   
Target Release: Director   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-17 16:53:08 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:
Attachments:
Description Flags
install undercloud log
none
Stack user install log (after running as root) none

Description Steven Hardy 2015-07-17 14:15:20 UTC
Description of problem:
If you mistakenly run the undercloud install as root, it all runs and then fails at the last step (probably a non-critical failure, but it's not a great user experience)

Version-Release number of selected component (if applicable):
instack-undercloud-2.1.2-21.el7ost.noarch
instack-0.0.7-1.el7ost.noarch


How reproducible:
Always

Steps to Reproduce:
1. Follow the docs, but forget to su - stack before doing the undercloud install

Actual results:
[2015-07-17 09:58:42,373] (os-refresh-config) [INFO] Completed phase post-configure
os-refresh-config completed successfully
Copy stackrc failed: cp: ‘/root/stackrc’ and ‘/root/stackrc’ are the same file

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/instack_undercloud/undercloud.py", line 527, in install
    _configure_ssh_keys()
  File "/usr/lib/python2.7/site-packages/instack_undercloud/undercloud.py", line 491, in _configure_ssh_keys
    _run_command(args, name='Copy stackrc')
  File "/usr/lib/python2.7/site-packages/instack_undercloud/undercloud.py", line 274, in _run_command
    env=env)
  File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['sudo', 'cp', '/root/stackrc', '/root']' returned non-zero exit status 1
ERROR: openstack Command 'instack-install-undercloud' returned non-zero exit status 1

Expected results:
Either we should error at the start saying don't do this as root, or we should tolerate it and not fail copying files at the end.

Additional info:

Comment 3 Steven Hardy 2015-07-17 14:18:13 UTC
Created attachment 1053099 [details]
install undercloud log

Comment 4 Steven Hardy 2015-07-17 14:25:41 UTC
Actually this appears to be hard to recover from - keystone appears misconfigured (I assume some stuff gets created/installed with wrong perms), so sourcing stackrc doesn't result in a working config.  Also re-running the install as stack fails (log attached).

So, I think the best plan is to fail at the start if the user is root.

Comment 5 Steven Hardy 2015-07-17 14:27:21 UTC
Created attachment 1053107 [details]
Stack user install log (after running as root)

Comment 6 Mike Burns 2015-07-17 16:53:08 UTC

*** This bug has been marked as a duplicate of bug 1239088 ***