Bug 1130347

Summary: "rhc server list" show that an unexpected server is in use if user change libra_server manually.
Product: OpenShift Container Platform Reporter: Johnny Liu <jialiu>
Component: ocAssignee: Miciah Dashiel Butler Masters <mmasters>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.1.0CC: bleanhar, ffranz, jdetiber, jokerman, libra-bugs, libra-onpremise-devel, mmccomas, xiuwang, xtian, yanywang
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhc-1.31.2-1.git.10.7c046c6.el6op Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1126388 Environment:
Last Closed: 2014-11-03 19:54:38 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:
Bug Depends On: 1126388    
Bug Blocks: 1128646    

Description Johnny Liu 2014-08-15 01:52:20 UTC
+++ This bug was initially created as a clone of Bug #1126388 +++

Description of problem:
If there are some existing servers in server.yml, then user manually change server in ~/.openshift/express.conf, rhc client does not repect this change, and shows rhc is using an unexpected server.

For those users who do not get familiar with rhc server new featrue, still like old habit, especially in auto script scenariose, change libra_server would more easy using sed tools than "rhc server", I think rhc should be compatible with manually editing libra_server in .openshift/express.conf

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

How reproducible:
Always

Steps to Reproduce:
1.Run "rhc setup --server xxxx" command, rhc would save these server into server.yml automatically.
$ rhc server list
Server 'prod' (in use)
----------------------
  Hostname:        openshift.redhat.com
  Login:           jialiu
  Use Auth Tokens: true
  Insecure:        false
  Timeout:         60
Server 'stage'
--------------
  Hostname:        stg.openshift.redhat.com
  Login:           jialiu
  Use Auth Tokens: true
  Insecure:        false
2. Manually change libra_server to another one in .openshift/express.conf
$ cat .openshift/express.conf
# The default OpenShift server to connect to
libra_server=10.66.78.210
3. Run "rhc server list"
4. Run 'rhc setup'

Actual results:
Step 3:
rhc is showing I am using 'stage'.
$ rhc server list 
Server 'prod'
-------------
  Hostname:        openshift.redhat.com
  Login:           jialiu
  Use Auth Tokens: true
  Insecure:        false
  Timeout:         60

Server 'stage' (in use)
-----------------------
  Hostname:        stg.openshift.redhat.com
  Login:           jialiu
  Use Auth Tokens: true
  Insecure:        false

Step 4:
rhc setup will use stage server
$ rhc setup
OpenShift Client Tools (RHC) Setup Wizard

This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git are properly installed.

If you have your own OpenShift server, you can specify it now. Just hit enter to use: stg.openshift.redhat.com.
Enter the server hostname: |stg.openshift.redhat.com|

Expected results:
If user manually change libra_server in .openshift/express.conf, rhc should respect it, and use it as default libra server, "rhc server list" should give some warning to say user is using an un-saved server. 

When user run "rhc setup" against modified libra_server in .openshift/express.conf, rhc should finish the wizard against this server, then save it in server list automatically.

Additional info:

--- Additional comment from Fabiano Franz on 2014-08-05 10:26:47 EDT ---

Fixed in https://github.com/openshift/rhc/pull/637

--- Additional comment from openshift-github-bot on 2014-08-05 14:07:32 EDT ---

Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/c4222ca7261183cd9063487484a375c98038bcd5
Bug 1126388 - must properly handle express.conf server missing on servers.yml

--- Additional comment from XiuJuan Wang on 2014-08-05 23:30:37 EDT ---

Checked rhc build from devenv_5043

1.Change libra_server in .openshift/express.conf manually,list server.
Could see the friendly message, and the new adding server is in use.
Check server.yml,don't server the new adding server info yet.
# rhc server list 
The server 'stg.openshift.redhat.com' is not configured. Please run 'rhc setup'.

Server 'online'
------------
  Hostname:        openshift.redhat.com
  Login:           XXXXXXXXXXXXXXX
  Use Auth Tokens: false
  Insecure:        false

Server 'stg' (in use)
---------------------
  Hostname: stg.openshift.redhat.com

2.Run setup as the promption, still show "The server 'stg.openshift.redhat.com' is not configured. Please run 'rhc setup'.This will make user confused.So assigen this bug back.

Another scenario:
Setup or add the first server, also show The server 'openshift.redhat.com' is not configured. Please run 'rhc setup'.Rhc always check the express.conf firstly.

# rhc setup -d 
The server 'openshift.redhat.com' is not configured. Please run 'rhc setup'.
DEBUG: Using config file /root/.openshift/express.conf
DEBUG: Running greeting_stage
OpenShift Client Tools (RHC) Setup Wizard

# rhc server add openshift.redhat.com  -d 
The server 'openshift.redhat.com' is not configured. Please run 'rhc setup'.
DEBUG: Using config file /root/.openshift/express.conf

--- Additional comment from openshift-github-bot on 2014-08-10 18:23:50 EDT ---

Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/166f00dfd2ab0aa4a82bc5b37e1cf9add4464756
Bug 1126388 - only warns if unconfigured server comes from conf files

--- Additional comment from Fabiano Franz on 2014-08-11 11:41:08 EDT ---

The behavior is still the same but we decided to remove the warning message. Will merge in https://github.com/openshift/rhc/pull/639

--- Additional comment from openshift-github-bot on 2014-08-11 16:25:45 EDT ---

Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/66fabd9b24b27df7893440150a4ea780c1241faa
Bug 1126388 - removed warning message

--- Additional comment from XiuJuan Wang on 2014-08-11 22:43:42 EDT ---

Check rhc-1.29.2.
Failed for below scenarios.It's better to fix them from my opinion.

Scenario one:
1.Change libra_server in .openshift/express.conf manually,list server.
Could see the friendly message
# rhc server list 
The server 'openshift.redhat.com' is not configured. Please run 'rhc setup'.

Server 'int'
------------
  Hostname:        int.openshift.redhat.com
  Login:           XXXXXXXXXXXXXXX
  Use Auth Tokens: false
  Insecure:        false

Server 'online' (in use)
---------------------
  Hostname: openshift.redhat.com

2.Then run 'rhc setup' according to the message.Still prompt the warning.Don't think it's a good way.

# rhc setup 
The server 'openshift.redhat.com' is not configured. Please run 'rhc setup'.
OpenShift Client Tools (RHC) Setup Wizard

Scenario two:
1.Change libra_server in .openshift/express.conf manually

2.Before run 'setup' for the non-configured server,add the third server and don't change default server.
Do some operation,could see the warning gone,even though I don't run setup for the manaully adding server.

# rhc server add int.openshift.redhat.com -l <user> 
The server 'openshift.redhat.com' is not configured. Please run 'rhc setup'.
Using <user> to login to int.openshift.redhat.com
Password: ******

[root@wangxiuj .openshift]# 
# rhc account
Login to openshift.redhat.com: XXXXXXX
Password: ******

Comment 1 Jason DeTiberus 2014-10-08 02:45:35 UTC
http://etherpad.corp.redhat.com/puddle-2-2-2014-10-07

Comment 3 wangyanyan 2014-10-08 07:51:56 UTC
Checked rhc build from ose 2.2/2014-10-07
rhc 1.31.2
1.Change libra_server in .openshift/express.conf manually,list server.
Could see the friendly message, and the new adding server is in use.
Check server.yml,don't server the new adding server info yet.
# rhc server list 
# rhc server list
Server '********' (not configured, run 'rhc setup')
------------------------------------------------------
  Hostname: *********

Server 'proc'
---------------------
  Hostname:        proc
  Login:           yanywang
  Use Auth Tokens: false
  Insecure:        true
2.rhc setup -d
# rhc setup -d
DEBUG: Using config file /root/.openshift/express.conf
DEBUG: Running greeting_stage
OpenShift Client Tools (RHC) Setup Wizard

This wizard will help you upload your SSH keys, set your application namespace,
and check that other programs like Git are properly installed.
DEBUG: Running server_stage

If you have your own OpenShift server, you can specify it now. Just hit enter to
use: **.**.**.**.

rhc server add openshift.redhat.com -d
# rhc server add openshift.rehdat.com -d
DEBUG: Using config file /root/.openshift/express.conf
DEBUG: Running login_stage
DEBUG: Connecting to https://openshift.rehdat.com/broker/rest/api
DEBUG: Client supports API versions 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7
DEBUG: Created new httpclient
DEBUG: Request GET https://openshift.rehdat.com/broker/rest/api
....

Comment 5 errata-xmlrpc 2014-11-03 19:54:38 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://rhn.redhat.com/errata/RHSA-2014-1796.html