This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1006067 - [RFE] Add better tooling in rhc to switch between accounts
[RFE] Add better tooling in rhc to switch between accounts
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Clayton Coleman
libra bugs
Depends On:
Blocks: 1006068
  Show dependency treegraph
Reported: 2013-09-09 19:13 EDT by Timothy Williams
Modified: 2013-09-25 16:41 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1006068 (view as bug list)
Last Closed: 2013-09-25 16:41:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Timothy Williams 2013-09-09 19:13:29 EDT
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/
cp ~/.openshift/express.conf ~/.openshift/express.conf.uat

2. Add these aliases to your ~/.bash_profile:
alias rhcd="rhc --config=~/.openshift/"
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
uat *

# rhc account --set prod
# rhc account --list
prod *
Comment 1 Xiaoli Tian 2013-09-09 23:27:13 EDT
You could work around this by setting OPENSHIFT_CONFIG env variable as well:

For eg:
Make different config file for different account under ~/.openshift/

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

will reset to use default config file.
Comment 2 Clayton Coleman 2013-09-25 16:41:04 EDT
Our only supported option now is the OPENSHIFT_CONFIG var as Xiaoli notes.  I would recommend aliasing that to the account in your shell.

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