Bug 1126388 - "rhc server list" show that an unexpected server is in use if user change libra_server manually.
Summary: "rhc server list" show that an unexpected server is in use if user change lib...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: oc
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Fabiano Franz
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks: 1128646 1130347
TreeView+ depends on / blocked
 
Reported: 2014-08-04 10:15 UTC by Johnny Liu
Modified: 2015-05-15 02:29 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1130347 (view as bug list)
Environment:
Last Closed: 2014-10-10 00:50:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Johnny Liu 2014-08-04 10:15:12 UTC
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:

Comment 1 Fabiano Franz 2014-08-05 14:26:47 UTC
Fixed in https://github.com/openshift/rhc/pull/637

Comment 2 openshift-github-bot 2014-08-05 18:07:32 UTC
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

Comment 3 XiuJuan Wang 2014-08-06 03:30:37 UTC
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

Comment 4 openshift-github-bot 2014-08-10 22:23:50 UTC
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

Comment 5 Fabiano Franz 2014-08-11 15:41:08 UTC
The behavior is still the same but we decided to remove the warning message. Will merge in https://github.com/openshift/rhc/pull/639

Comment 6 openshift-github-bot 2014-08-11 20:25:45 UTC
Commit pushed to master at https://github.com/openshift/rhc

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

Comment 7 XiuJuan Wang 2014-08-12 02:43:42 UTC
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 8 Fabiano Franz 2014-08-18 19:17:16 UTC
The warning message was removed, everything else stays the same.

Comment 9 Fabiano Franz 2014-08-18 21:31:04 UTC
Fixed in https://github.com/openshift/rhc/pull/642

The warning message will not be displayed anymore, however when listing servers and a given server is only present in express.conf it will be displayed in yellow with a 'not configured' instead of 'in use' message in the servers list.

Comment 10 openshift-github-bot 2014-08-18 22:23:53 UTC
Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/c434a88df2f5a380d54fcfa7906dfdbdbab943c1
Bug 1126388 - when displaying servers will warn if a given server is not yet configured

Comment 11 XiuJuan Wang 2014-08-19 03:24:28 UTC
Verified with rhc-1.29.6 build from devenv_5089

A given server is only present in express.conf it will be displayed in yellow with a 'not configured' instead of 'in use' message in the servers list

# rhc server list 
Server 'int' (not configured, run 'rhc setup')
----------------------------------------------
  Hostname: int.openshift.redhat.com

Server 'stg'
------------
  Hostname:        stg.openshift.redhat.com
  Login:           xiuwang
  Use Auth Tokens: true
  Insecure:        false

You have 2 servers configured. Use 'rhc server use <hostname|nickname>' to switch between them.


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