Bug 1281728

Summary: atomic-openshift-installer should give friendly prompt when some facts missing in installer.cfg.yml
Product: OpenShift Container Platform Reporter: Gaoyun Pei <gpei>
Component: InstallerAssignee: Samuel Munilla <smunilla>
Status: CLOSED ERRATA QA Contact: Ma xiaoqiang <xiama>
Severity: low Docs Contact:
Priority: medium    
Version: 3.1.0CC: aos-bugs, bleanhar, jokerman, mmccomas, smunilla, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 16:37: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 Gaoyun Pei 2015-11-13 10:14:49 UTC
Description of problem:
Run 'atomic-openshift-installer install' in unattended way, once no "connect_to", "master" or "node" facts defined in the installer config yaml file, the installer would throw an exception, which is unfriendly. 

Version-Release number of selected component (if applicable):
atomic-openshift-utils-3.0.12-1.git.0.4c09c5b.el7aos.noarch

How reproducible:
Always

Steps to Reproduce:
1.Prepare an installer config yaml file which not contains "connect_to" facts
2.[root@openshift-v3 ~]# atomic-openshift-installer -u -c installer.cfg.yml install
Traceback (most recent call last):
  File "/usr/bin/atomic-openshift-installer", line 9, in <module>
    load_entry_point('ooinstall==3.0.0', 'console_scripts', 'oo-install')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 988, in invoke
    Command.invoke(self, ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/ooinstall/cli_installer.py", line 442, in cli
    oo_cfg = OOConfig(ctx.obj['configuration'])
  File "/usr/lib/python2.7/site-packages/ooinstall/oo_config.py", line 85, in __init__
    self._read_config()
  File "/usr/lib/python2.7/site-packages/ooinstall/oo_config.py", line 104, in _read_config
    self.hosts.append(Host(**host))
  File "/usr/lib/python2.7/site-packages/ooinstall/oo_config.py", line 48, in __init__
    raise OOConfigInvalidHostError("You must specify either and 'ip' " \
ooinstall.oo_config.OOConfigInvalidHostError: You must specify either and 'ip' or 'hostname' to connect to.

3. Prepare an installer config yaml file which not contains "master" or "node" facts
4. [root@openshift-v3 ~]# atomic-openshift-installer -u -c installer.cfg.yml install
Traceback (most recent call last):
  File "/usr/bin/atomic-openshift-installer", line 9, in <module>
    load_entry_point('ooinstall==3.0.0', 'console_scripts', 'oo-install')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 988, in invoke
    Command.invoke(self, ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/ooinstall/cli_installer.py", line 442, in cli
    oo_cfg = OOConfig(ctx.obj['configuration'])
  File "/usr/lib/python2.7/site-packages/ooinstall/oo_config.py", line 85, in __init__
    self._read_config()
  File "/usr/lib/python2.7/site-packages/ooinstall/oo_config.py", line 104, in _read_config
    self.hosts.append(Host(**host))
  File "/usr/lib/python2.7/site-packages/ooinstall/oo_config.py", line 53, in __init__
    "You must specify each host as either a master or a node.")
ooinstall.oo_config.OOConfigInvalidHostError: You must specify each host as either a master or a node.


Actual results:


Expected results:
Should give friendly prompt just as when missing "ip, hostname..."
[root@openshift-v3 ~]# atomic-openshift-installer -u -c installer.cfg.yml install
For unattended installs, facts must be provided for all masters/nodes:
Host "xxx" missing facts: ip, hostname


Additional info:

Comment 1 Samuel Munilla 2016-03-04 13:46:47 UTC
No longer stack tracing on latest master:

~/Development/openshift-ansible (master)$ atomic-openshift-installer --unattended install
You must specify either an ip or hostname as 'connect_to'

Comment 2 Gaoyun Pei 2016-03-07 03:06:33 UTC
Verify this bug on package atomic-openshift-utils-3.0.51-1.git.0.faacbce.el7.noarch

When some facts missing from the install file:
*no master or node specified on a host
[root@host-192-168-1-57 ~]# atomic-openshift-installer -c installer.cfg.yml -u install 
You must specify each host as either a master or a node.

*no ip specified on a host
[root@host-192-168-1-57 ~]# atomic-openshift-installer -c installer.cfg.yml -u install 
For unattended installs, facts must be provided for all masters/nodes:
Host "10.66.79.117" missing facts: ip

*no connect_to specified on a host
[root@host-192-168-1-57 ~]# atomic-openshift-installer -c installer.cfg.yml -u install 
You must specify either an ip or hostname as 'connect_to'

*no hostname and public_hostname specified on a host
[root@host-192-168-1-57 ~]# atomic-openshift-installer -c installer.cfg.yml -u install 
For unattended installs, facts must be provided for all masters/nodes:
Host "10.66.79.152" missing facts: hostname, public_hostname

Thanks!

Comment 4 errata-xmlrpc 2016-05-12 16:37: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, 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-2016:1065