Bug 1006068

Summary: [RFE] Add better tooling in rhc to switch between accounts
Product: OpenShift Container Platform Reporter: Timothy Williams <tiwillia>
Component: RFEAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: high    
Version: 1.2.1CC: adellape, aenright, bleanhar, cryan, libra-onpremise-devel, mmasters, tiwillia, yanpzhan
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rhc-1.28.5.1-1.el6op Doc Type: Enhancement
Doc Text:
Previous versions of the client tools were configured for use with a single OpenShift server at a time. The configuration settings in the ~/.openshift/express.conf file would be overwritten each time the client tools were configured for use with a new server. This enhancement enables the client tools shipped with OpenShift Enterprise to be configured for use with multiple servers, which is useful when using a single workstation to manage different applications hosted across multiple servers. See the OpenShift Enterprise User Guide for more information.
Story Points: ---
Clone Of: 1006067 Environment:
Last Closed: 2014-08-26 13:52:06 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: 1006067    
Bug Blocks:    

Description Timothy Williams 2013-09-09 23:14:01 UTC
+++ This bug was initially created as a clone of Bug #1006067 +++

We have several different OSE deployments now as we've separated pre-production from production, etc.  At first, folks were hand-editing rhc's ~/.openshift/express.conf all the time.  Now, folks are doing this as a workaround:

1. Copy your existing .openshift/express.conf to new files, one per environment:
cp ~/.openshift/express.conf ~/.openshift/express.conf.dev
cp ~/.openshift/express.conf ~/.openshift/express.conf.uat


2. Add these aliases to your ~/.bash_profile:
alias rhcd="rhc --config=~/.openshift/express.conf.dev"
alias rhcu="rhc --config=~/.openshift/express.conf.uat"

3.  Use your new commands (after logging out and back in, so your bash_profile takes effect):
# SSH to the UAT security service:
rhcu ssh security

That's a fine workaround, but I'd like to see "rhc account" get extended with something like "--list" and "--set", where "--list" gave you a one-line list of alternate OpenShift account aliases (such as "dev" and "uat", or "default" for initial default settings).  "--set" would let you pick a different alias.  "rhc setup" should let you pick an alias for those different configs going forward.

So the interaction would be something like::

# rhc account --list
default
dev
uat *
prod

# rhc account --set prod
# rhc account --list
default
dev
uat
prod *

Comment 3 Timothy Williams 2014-07-07 16:36:42 UTC
Yes, that trello card is exactly what is needed to satisfy this RFE.

Comment 4 Brenton Leanhardt 2014-08-08 13:44:37 UTC
*** Bug 1009881 has been marked as a duplicate of this bug. ***

Comment 7 Yanping Zhang 2014-08-11 08:24:28 UTC
Verified on rhc-1.28.5.1-1.el6op.noarch.
Steps to verify:
There is rhc server command now implemented to configure multiple servers.
1.Could add multiple servers with rhc server:
# rhc server add 10.3.8.136
# rhc server add 10.66.78.209
2.Could set nickname for server,such as:
# rhc server configure --server 10.3.8.136 --nickname server1
3.Could list all the servers:
# rhc server list
Server '10.66.78.209' (in use)
------------------------------
  Hostname:        10.66.78.209
  Login:           zyp
  Use Auth Tokens: true
  Insecure:        true
Server 'server1'
----------------
  Hostname:        10.3.8.136
  Login:           test
  Use Auth Tokens: true
  Insecure:        true
4.Could choose to use listed server:
# rhc server use --server server1
Server '10.66.78.209'
---------------------
  Hostname:        10.66.78.209
  Login:           zyp
  Use Auth Tokens: true
  Insecure:        true
Server 'server1' (in use)
-------------------------
  Hostname:        10.3.8.136
  Login:           test
  Use Auth Tokens: true
  Insecure:        true
When the server is in use, we can run common operations against it.eg control app:
# rhc app create testapp php-5.4
# rhc app show testapp --gears
ID                       State   Cartridges Size  SSH URL
------------------------ ------- ---------- ----- ----------------------------------------------------------
53e87c8216ae3171a000010f started php-5.4    small 53e87c8216ae3171a000010f.example.com
# rhc app delete testapp --confirm
Deleting application 'testapp' ... deleted


5.Have configre file server.yml produced in ~/.openshift,and all servers' info is contained in the file.
# cat ~/.openshift/server.yml
Server '10.66.78.209'
---------------------
  Hostname:        10.66.78.209
  Login:           zyp
  Use Auth Tokens: true
  Insecure:        true
Server 'server1' (in use)
-------------------------
  Hostname:        10.3.8.136
  Login:           test
  Use Auth Tokens: true
  Insecure:        true
5.Could show,check staus of servers:
# rhc server show server1
Server 'server1' (in use)
-------------------------
  Hostname:        10.3.8.136
  Login:           test
  Use Auth Tokens: true
  Insecure:        true
# rhc server status 10.66.78.209
Connected to 10.66.78.209
Using API version 1.6
6.Could remove server not in use from list:
# rhc server remove 10.66.78.209
Removing '10.66.78.209' ... done
# rhc server list
Server 'server1' (in use)
-------------------------
  Hostname:        10.3.8.136
  Login:           test
  Use Auth Tokens: true
  Insecure:        true

Comment 9 errata-xmlrpc 2014-08-26 13:52:06 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.

http://rhn.redhat.com/errata/RHBA-2014-1095.html