@Experimental(feature=ExperimentalFeature.PATCH_UPGRADES)
  public CommandRepository getCommandRepository(final Cluster cluster, final Service service, final Host host,
                                                final String componentName) throws AmbariException {
    CommandRepository commandRepository = null;
    try {
      if (null != componentName) {
        ServiceComponent serviceComponent = service.getServiceComponent(componentName);
        commandRepository = getCommandRepository(cluster, serviceComponent, host);
      } else {
        RepositoryVersionEntity repoVersion = service.getDesiredRepositoryVersion();
        RepoOsEntity osEntity = getOSEntityForHost(host, repoVersion);
        commandRepository = getCommandRepository(repoVersion, osEntity);
      }
    } catch (SystemException e){
      LOG.debug("Unable to find command repository with a correct operating system for host {}",
        host, e);
    }

    return commandRepository;
  }
Builds repository information for inclusion in a command.  This replaces escaping json on
a command.

@param cluster the cluster
@param host    the host
@param component {@link ServiceComponent} object, could be null to return service-related repository
@return  the command repository
@throws SystemException
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/RepositoryVersionHelper.java