Bug 999602

Summary: `rhc foo --help` where foo is a management command lists actions in random order
Product: OpenShift Online Reporter: Miciah Dashiel Butler Masters <mmasters>
Component: ocAssignee: Miciah Dashiel Butler Masters <mmasters>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: high    
Version: 1.xCC: wjiang
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Commands were stored in a hash and printed without an explicit ordering Consequence: Commands were listed in random order in help output Fix: Commands are now sorted before being listed Result: Help output now always lists commands in alphabetical order
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-17 13:28:05 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:

Description Miciah Dashiel Butler Masters 2013-08-21 16:53:41 UTC
Description of problem:
When displaying the help for a management command with multiple actions, rhc lists the commands in random order.

This is the case for all management commands with multiple actions: account, alias, app, authorization, cartridge, domain, env, or sshkey.

How reproducible:
Pretty reproducible.

Steps to Reproduce:
1. rhc cartridge --help
2. rhc cartridge --help

Actual results:
Varies.  For example, one time I got the following:

    [...]
    List of Actions
      add           Add a cartridge to your application
      restart       Restart a cartridge
      reload        Reload the cartridge's configuration
      status        Get current the status of a cartridge
      stop          Stop a cartridge
      storage       View/manipulate storage on a cartridge
      start         Start a cartridge
      scale         Set the scale range for a cartridge
      list          List available cartridges
      remove        Remove a cartridge from your application
      show          Show useful information about a cartridge
    [...]

On the next try, I got the following:

    [...]
    List of Actions
      add           Add a cartridge to your application
      restart       Restart a cartridge
      reload        Reload the cartridge's configuration
      status        Get current the status of a cartridge
      stop          Stop a cartridge
      storage       View/manipulate storage on a cartridge
      start         Start a cartridge
      scale         Set the scale range for a cartridge
      list          List available cartridges
      remove        Remove a cartridge from your application
      show          Show useful information about a cartridge
    [...]


Expected results:
Actions should be consistently listed in the some reasonable ordering, perhaps alphabetically.

Comment 1 Miciah Dashiel Butler Masters 2013-08-21 16:54:45 UTC
https://github.com/openshift/rhc/pull/443

Comment 2 openshift-github-bot 2013-08-21 20:29:02 UTC
Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/38db50b10937689f87d5278108cf2cba8eaa4d92
RHC::CommandHelpBindings: Sort commands

In RHC::CommandHelpBindings#initialize, we need to sort instance_commands
so that they are listed with consistent ordering.

This commit fixes bug 999602.

Comment 3 weiwei jiang 2013-10-11 02:50:51 UTC
Tried on devenv_3684 via rhc-build_from_devenv_3684, and tried following commands:
# rhc cartridge --help
List of Actions
  add           Add a cartridge to your application
  list          List available cartridges
  reload        Reload the cartridge's configuration
  remove        Remove a cartridge from your application
  restart       Restart a cartridge
  scale         Set the scale range for a cartridge
  show          Show useful information about a cartridge
  start         Start a cartridge
  status        Get current the status of a cartridge
  stop          Stop a cartridge
  storage       View/manipulate storage on a cartridge
# rhc alias --help
List of Actions
  add           Add a custom domain name for the application
  delete-cert   Delete the SSL certificate from an existing alias
  list          List the aliases on an application
  remove        Remove a custom domain name for the application
  update-cert   Add or change the SSL certificate for an existing alias
# rhc app --help
List of Actions
  create        Create an application
  delete        Delete an application from the server
  force-stop    Stops all application processes
  reload        Reload the application's configuration
  restart       Restart the application
  show          Show information about an application
  start         Start the application
  stop          Stop the application
  tidy          Clean out the application's logs and tmp directories and tidy up the git repo on the server
# rhc authorization --help
List of Actions
  add           Add an authorization to your account
  delete        Delete one or more authorization tokens
  delete-all    Delete all authorization tokens from your account
  list          Show the authorization tokens for your account
# rhc domain --help
List of Actions
  configure     Change one or more configuration settings on the domain
  create        Create a new container for applications.
  delete        Delete a domain
  leave         Leave a domain (remove your membership)
  list          Display all domains you have access to
  rename        Rename a domain (will change application urls)
  show          Display a domain and its applications
# rhc env --help
List of Actions
  list          List all environment variables set on the application
  set           Set one or more environment variable(s) to your application
  show          Show the value of one or more environment variable(s) currently set to your application
  unset         Remove one or more environment variable(s) currently set to your application
# rhc member --help
List of Actions
  add           Add or update a member on a domain
  list          List members of a domain or application
  remove        Remove a member from a domain

So, all actions are in alphabetical order, verified this issue.