Bug 1278933 - oo-install - ctrl-c able to create district with no node
Summary: oo-install - ctrl-c able to create district with no node
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: ---
Assignee: Rory Thrasher
QA Contact: Ma xiaoqiang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-06 19:10 UTC by Rory Thrasher
Modified: 2016-07-04 00:46 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-12 16:37:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1065 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise atomic-openshift-utils bug fix update 2016-05-12 20:32:56 UTC

Description Rory Thrasher 2015-11-06 19:10:21 UTC
Description of problem:

Users are able to abort the oo-install script with ctrl-c at a certain point where there will be a district created with no node that will be saved to the oo-install-cfg.yaml file.  Users should be unable to get a district with no nodes.



Example output:
==================================================================
Select an action from below:
1. Add a district
2. Modify a district
3. Remove a district
Type a selection and press <return>: 1

There are currently no Nodes that can be moved to a new district,
however the new district will should have a node.
Choose a resolution from below:
1. Create a new Node to be associated with the new district
2. Continue process and delete an existing district to free a Node
Type a selection and press <return>: 2

What is the name of the district? newdistrict

What gear size will be associated with this district?:
1. small
Type a selection and press <return>: 1

Currently there are no Node hosts associated with this district.

Choose a Node host to add to this district:
1. hostname1.example.com (current district: Default)
2. hostname2.example.com (current district: district2)
3. hostname3.example.com (current district: district3)
4. hostname4.example.com (current district: district4)
Type a selection and press <return>: 4

There is only one Node associated with the district4 district. If you
move it to another district, this district will be automatically
deleted. Is it okay to proceed? (y/n/q) n

Currently there are no Node hosts associated with this district.

Choose a Node host to add to this district:
1. hostname.thrasher.com (current district: Default)
2. hostname2.thrasher.com (current district: district5)
3. hostname3.thrasher.com (current district: district7)
4. hostname4.thrasher.com (current district: district8)
Type a selection and press <return>: ^C
Exiting oo-install at user request.
===========================================================================



How reproducible:
Always


Steps to Reproduce:
1. Create situation where each district has exactly one node.
2. Attempt to add a new node using oo-install
3. Hit ctrl-c to abort the script at the point in the example script output (or perhaps even earlier within that cycle).

Actual results:

Check oo-install-cfg.yaml or run oo-install again to see that a district "newdistrict" has been created without a node.


Expected results:

Oo-install should not have saved the empty district until a node has been chosen, so that aborting the script will not create the district at all.


Additional info:
The bug was noticed and the abort point in the script was referenced in the following bug: https://bugzilla.redhat.com/show_bug.cgi?id=1259072

Comment 2 Rory Thrasher 2015-11-06 21:29:13 UTC
Further testing shows exactly when a new district appears.

==========================================================================
Currently there are no Node hosts associated with this district.

Choose a Node host to add to this district:
1. hostname.example.com (current district: Default)
2. hostname2.example.com (current district: district2)
3. hostname3.example.com (current district: district3)
4. hostname4.example.com (current district: district4)
Type a selection and press <return>: ^Z
[1]+  Stopped                 bundler exec bin/oo-install
[root@thrasher-1259072 oo-install]# cat ~/.openshift/oo-install-cfg.yml | grep 'baddistrict'
[root@thrasher-1259072 oo-install]# fg
bundler exec bin/oo-install
4

There is only one Node associated with the district4 district. If you
move it to another district, this district will be automatically
deleted. Is it okay to proceed? (y/n/q) ^Z
[1]+  Stopped                 bundler exec bin/oo-install
[root@thrasher-1259072 oo-install]# cat ~/.openshift/oo-install-cfg.yml | grep 'baddistrict'
[root@thrasher-1259072 oo-install]# fg
bundler exec bin/oo-install
y
*****SAVE TO DISK HAPPENS HERE*****

Currently these Node hosts are associated with this district:
  * hostname4.example.com

Do you want to add or remove Nodes from this district? (y/n/q) ^Z
[1]+  Stopped                 bundler exec bin/oo-install
[root@thrasher-1259072 oo-install]# cat ~/.openshift/oo-install-cfg.yml | grep 'baddistrict'
    name: baddistrict

Comment 3 Rory Thrasher 2015-11-09 16:27:11 UTC
https://github.com/openshift/openshift-extras/pull/539


Users should not be able to abort the script (with ctrl-c) during the add district processes and end up with an empty district.  Specifically after answer the question "There is only one Node associated with the DISTRICTNAME district. If you move it to another district, this district will be automatically deleted. Is it okay to proceed?"

The oo-install-cfg.yml file should not have the new district DISTRICTNAME, and running the script again should not show DISTRICTNAME as an empty district.

Comment 4 Rory Thrasher 2015-11-10 19:51:04 UTC
Should be able to test the code using:


sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1278933)

Comment 5 Yanping Zhang 2015-11-11 05:29:28 UTC
Could not reproduce the issue with https://install.openshift.com/ose-2.2.
Tested on 
sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1278933)
Steps to verify:
1.Prepare 3 hosts.
2.Run 
sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1278933) on one host.
3.Try to abort at the 3 points below:
(1)Choose a Node host to add to this district:
1. node1.hosts.ose22.com (current district: Default)
2. node2.hosts.ose22.com (current district: district2)
Type a selection and press <return>: ^Z
(2)There is only one Node associated with the district2 district. If you
move it to another district, this district will be automatically
deleted. Is it okay to proceed? (y/n/q) ^Z
(3)Do you want to add or remove Nodes from this district? (y/n/q) ^Z

For point (1) and (2), there will be no emptry district created in the .openshift/oo-install-cfg.yml file and during the scipt running again.
For point (3), the new district is created with a node moved in.

Since there is no empty district existing now, so move the bug to Verified.

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


Note You need to log in before you can comment on or make changes to this bug.