public class RepositoryVersionHelper extends Object
Constructor and Description |
---|
RepositoryVersionHelper() |
Modifier and Type | Method and Description |
---|---|
void |
addCommandRepositoryToContext(ActionExecutionContext context,
RepositoryVersionEntity repoVersion,
RepoOsEntity osEntity)
Adds a command repository to the action context
|
void |
addRepoInfoToHostLevelParams(Cluster cluster,
ActionExecutionContext actionContext,
RepositoryVersionEntity repositoryVersion,
Map<String,String> hostLevelParams,
String hostName)
Deprecated.
|
Map<String,String> |
buildRoleParams(AmbariManagementController amc,
RepositoryVersionEntity repoVersion,
String osFamily,
Set<String> servicesOnHost)
Build the role parameters for an install command.
|
List<RepoOsEntity> |
createRepoOsEntities(List<RepositoryInfo> repositories) |
CommandRepository |
getCommandRepository(Cluster cluster,
ServiceComponent component,
Host host)
Builds repository information for inclusion in a command.
|
CommandRepository |
getCommandRepository(Cluster cluster,
Service service,
Host host,
String componentName) |
CommandRepository |
getCommandRepository(RepositoryVersionEntity repoVersion,
RepoOsEntity osEntity)
Adds a command repository to the action context
|
RepoOsEntity |
getOSEntityForHost(Host host,
RepositoryVersionEntity repoVersion)
Return repositories available for target os version on host based on
repoVersion repository definition |
String |
getRepoInfo(Cluster cluster,
ServiceComponent component,
Host host)
Deprecated.
|
String |
getRepoInfoString(Cluster cluster,
ServiceComponent component,
Host host)
Get repository info given a cluster and host.
|
String |
getUpgradePackageName(String stackName,
String stackVersion,
String repositoryVersion,
org.apache.ambari.spi.upgrade.UpgradeType upgradeType)
Scans the given stack for upgrade packages which can be applied to update the cluster to given repository version.
|
List<RepoOsEntity> |
parseOperatingSystems(String repositoriesJson)
Parses operating systems json to a list of entities.
|
public List<RepoOsEntity> parseOperatingSystems(String repositoriesJson) throws Exception
[ { "repositories":[ { "Repositories/base_url":"http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/updates/2.2.0.0", "Repositories/repo_name":"HDP-UTILS", "Repositories/repo_id":"HDP-UTILS-1.1.0.20" }, { "Repositories/base_url":"http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/updates/2.2.0.0", "Repositories/repo_name":"HDP", "Repositories/repo_id":"HDP-2.2" } ], "OperatingSystems/os_type":"redhat6" } ]
repositoriesJson
- operating systems jsonException
- if any kind of json parsing error happenedpublic List<RepoOsEntity> createRepoOsEntities(List<RepositoryInfo> repositories)
public String getUpgradePackageName(String stackName, String stackVersion, String repositoryVersion, org.apache.ambari.spi.upgrade.UpgradeType upgradeType) throws org.apache.ambari.server.AmbariException
stackName
- stack namestackVersion
- stack versionrepositoryVersion
- target repository versionupgradeType
- if not null
null, will only return upgrade packs whose type matches.org.apache.ambari.server.AmbariException
- if no upgrade packs suit the requirementspublic Map<String,String> buildRoleParams(AmbariManagementController amc, RepositoryVersionEntity repoVersion, String osFamily, Set<String> servicesOnHost) throws SystemException
amc
- the management controller. Tests don't use the same instance that gets injected.repoVersion
- the repository versionosFamily
- the os familyservicesOnHost
- the set of services to check for packagesSystemException
public RepoOsEntity getOSEntityForHost(Host host, RepositoryVersionEntity repoVersion) throws SystemException
repoVersion
repository definitionhost
- target Host
for providing repositories listrepoVersion
- RepositoryVersionEntity
version definition with all available repositoriesRepoOsEntity
with available repositories for hostSystemException
- if no repository available for target Host
public CommandRepository getCommandRepository(RepositoryVersionEntity repoVersion, RepoOsEntity osEntity) throws SystemException
osEntity
- the OS familySystemException
public CommandRepository getCommandRepository(Cluster cluster, ServiceComponent component, Host host) throws SystemException
cluster
- the clusterhost
- the hostcomponent
- ServiceComponent
object, could be null to return service-related repositorySystemException
public CommandRepository getCommandRepository(Cluster cluster, Service service, Host host, String componentName) throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
@Deprecated public void addRepoInfoToHostLevelParams(Cluster cluster, ActionExecutionContext actionContext, RepositoryVersionEntity repositoryVersion, Map<String,String> hostLevelParams, String hostName) throws org.apache.ambari.server.AmbariException
cluster
- cluster to which host level params belongsactionContext
- context of the action. Must be not null
repositoryVersion
- repository version entity to usehostLevelParams
- hasgmap with host level params. Must be not null
hostName
- host name to which add repo onfoorg.apache.ambari.server.AmbariException
@Deprecated public String getRepoInfo(Cluster cluster, ServiceComponent component, Host host) throws SystemException
getCommandRepository(Cluster, ServiceComponent, Host)
instead.cluster
- the clusterhost
- the hostSystemException
- if the repository information can not be obtainedpublic void addCommandRepositoryToContext(ActionExecutionContext context, RepositoryVersionEntity repoVersion, RepoOsEntity osEntity) throws SystemException
context
- the contextosEntity
- the OS familySystemException
public String getRepoInfoString(Cluster cluster, ServiceComponent component, Host host) throws org.apache.ambari.server.AmbariException, SystemException
cluster
- the clusterhost
- the hostorg.apache.ambari.server.AmbariException
- if the repository information can not be obtainedSystemException
Copyright © 2022 Apache Software Foundation. All rights reserved.