Merge pull request #1538 from bbuckingham/fork_content_views_merge

Fork content views merge
content views - fix product repo selector behavior for deleting a repo

When user would 'delete' a repo from the list, the code was removing
the incorrect repo.
content views - adding initial support for cv environments w/ candlepin support

This commit contains initial changes to ensure that candlepin is aware
of content views.  From a candlepin point of view, a content view will
be an environment (e.g. 'dev/view_1').  To support this, a
'content view environment' will be creaetd within katello which will
also create an environment within candlepin.

Katello will create those environments when a view is promoted in
to an environment.  During view promotion, if the content view
environment already exists, one will not be created; otherwise,
it will.  In addition, when that view is promoted, the
candlepin environment will get associated with the repositories
(cp_content) that are in that view.

With these changes a consumer that is register to a view
(e.g. 'dev/view_1') will now be able to consume content
that is subscribes to that is in that view.
content views - consumer - see views as envs and allow registration to view

This commit contains the basic katello-side changes to allow
consumers to perform:

1. subscription-manager environments => to list the environments
   (e.g. dev, test, prod...) and content views (e.g. dev/view_1,
   dev/view_2...) that the consumer may register to

2. subscription-manager register => to allow user to register
   to any of the environments/views listed in 1 above.

In order to support environment listing or registration, the
consumer must retrieve environment details from katello.
Prior to these changes, that was performed using the
api/environments_controller index action, which is also used
to support cli/api commands for environments.  Since content
view environments are not the same as traditional environment
paths (e.g. dev, test prod), a new rhsm_index action was
introduced so that the requests from rhsm will take in to
account both the traditional environments and content
view environments without impacting the existing cli
actions that do not need to be muddied by content view
environments.  (Unfortunately, adding in the content view
environment makes some of that logic look more complicated than
it really is... :( ).

As for consumer registration, the system create was also
updated, so that it can properly handle creating that
system that is being associated with a content view.
(Note: content view is optional for a system.)
content views - handle case where system create contains numeric id for env
content views - fix few tests broken when adding content view env
content view - fix content_view_version_environment to properly access view name
content views - simplify environments for rhsm

This commit contains changes so that:
- when a kt_environment is created, a content_view_environment is
  also created, and it is associated with that kt_environment's
  'default content view'

- when a user (via subscription-manager) lists environments,
  the environments listed are based upon available content_view_environments.
  this is now possible, since traditional (kt) environments
  as well as those from promoting views, will exist there

- when a user (via subscription-manager) registers a client
  to an environment, the environment will be determined based
  on available content_view_environments.

note: with these changes when a kt_environment is created,
both it and the corresponding content_view_environment will
point to the same candlepin environment (i.e. cp_environment).
content views - only associate cp_environment with content_view_environment

This commit contains changes that will remove the direct
association of a kt_environment with a cp_environment.

Since every kt_environment will be associated with a default
content_view, which is associated with a content_view_environment,
which is associated with a cp_environment, there is no need
to manage cp_environments both at the kt_environment
and content view levels.

With this cp_environments will always be managed as part
of content views.