> On July 31, 2017, 4:25 p.m., Alejandro Fernandez wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
> > Lines 1123 (patched)
> > <https://reviews.apache.org/r/61239/diff/1/?file=1785542#file1785542line1123>
> >
> > Add a safeguard here in case indexOf returns -1. Only if > 0 should the
> > substring method be called to get the os.
> > This also assumes majorVersion is a single digit, instead look for the
> > numeric characters from the end.
Hello Alejandro,
The osFamily var was checked earlier in the code if "-ppc" exists. So by the
time it reaches the indexOf, the osFamily can either be null (already
safeguarded) or a string that contains "-ppc", so the indexof will have
positive value.
For single digit issue, the current logic can deal with multiple digit
"""
String osType = "redhat100";
String os = osType.substring(0, "redhat-ppc".indexOf("-ppc"));
String majorVersion = osType.substring(os.length());
String result = String.format("OS: %s, majorVersion: %s", os, majorVersion);
System.out.println(result);
"""
OUTPUT: OS: redhat, arch: ppc, majorVersion: 100
- Di
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61239/#review181811
-----------------------------------------------------------
On July 29, 2017, 2:12 a.m., Di Li wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61239/
> -----------------------------------------------------------
>
> (Updated July 29, 2017, 2:12 a.m.)
>
>
> Review request for Ambari, Alejandro Fernandez, Jonathan Hurley, Sid Wagle,
> and Tim Thorpe.
>
>
> Bugs: AMBARI-21611
> https://issues.apache.org/jira/browse/AMBARI-21611
>
>
> Repository: ambari
>
>
> Description
> -------
>
> Error message: Repositories for os type redhat-ppc7 are not defined.
> This is because:
> AmbariAgent reports os type (to be stored in the Hosts table) as redhat-ppc7.
> "-ppc" is a hardcoded post fix attached to the os type in os_check.py
> """
> os_check.py (AMBARI-21054)
> if _is_powerpc():
> operatingSystem += '-ppc'
> """
> When Ambari server backend generates the
> {os, repo}
> map, it uses os information from repo_versoin as the key . But later on uses
> os info from the Hosts table to query the map, thus the mismatch (redhat-ppc7
> vs redhat7).
> The repo_version table repository column however only uses redhat6/7 and does
> not distinguish ppc vs x86 ( nor it should )
>
>
> Diffs
> -----
>
>
> ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
> 633fe8c
>
> ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProviderTest.java
> 7018245
>
>
> Diff: https://reviews.apache.org/r/61239/diff/1/
>
>
> Testing
> -------
>
> one IOP ppc one IOP x86, upgrade Ambari, patch with server jar, run install
> packages after registering HDP 2.6.2 stack. verify the error did not appear
> any more for ppc, both ppc and x86 cluster were able to finish the install
> package step successfully
>
>
> Thanks,
>
> Di Li
>
>