Bug 1006067

Summary: [RFE] Add better tooling in rhc to switch between accounts
Product: OKD Reporter: Timothy Williams <tiwillia>
Component: ocAssignee: Clayton Coleman <ccoleman>
Status: CLOSED WONTFIX QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 1.xCC: xtian
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1006068 (view as bug list) Environment:
Last Closed: 2013-09-25 20:41:04 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:    
Bug Blocks: 1006068    

Description Timothy Williams 2013-09-09 23:13:29 UTC
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 1 Xiaoli Tian 2013-09-10 03:27:13 UTC
You could work around this by setting OPENSHIFT_CONFIG env variable as well:


For eg:
Make different config file for different account under ~/.openshift/
express.conf
dev.conf
uat.conf
prod.conf

export OPENSHIFT_CONFIG=dev&rhc setup will run  with the server and account set in dev.conf 

#export OPENSHIFT_CONFIG= 
will reset to use default config file.

Comment 2 Clayton Coleman 2013-09-25 20:41:04 UTC
Our only supported option now is the OPENSHIFT_CONFIG var as Xiaoli notes.  I would recommend aliasing that to the account in your shell.