[
https://issues.apache.org/jira/browse/AMBARI-24632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Doroszlai, Attila resolved AMBARI-24632.
----------------------------------------
Resolution: Fixed
> APT/DPKG existence check doesn't work for system packages
> ---------------------------------------------------------
>
> Key: AMBARI-24632
> URL: https://issues.apache.org/jira/browse/AMBARI-24632
> Project: Ambari
> Issue Type: Bug
> Reporter: Doroszlai, Attila
> Assignee: Dmytro Grinenko
> Priority: Minor
> Labels: pull-request-available
> Fix For: 2.8.0
>
> Time Spent: 3.5h
> Remaining Estimate: 0h
>
> Package existence check for APT/DPKG is a bit too strict:
> {noformat:title=https://github.com/apache/ambari/blob/c17762bdd91fddc0cca87d3aa24e4121c7b5e675/ambari-common/src/main/python/ambari_commons/repo_manager/apt_manager.py#L70}
> check_cmd = pkg_manager_bin + " --get-selections | grep -v deinstall | awk
> '{print $1}' | grep ^%s$"
> {noformat}
> Also in previous versions:
> https://github.com/apache/ambari/blob/64cc76bfc7c83707f395d8487ea983dc8fddb267/ambari-common/src/main/python/resource_management/core/providers/package/apt.py#L51
> System packages are postfixed by architecture, hence {{grep}} fails to find
> these due to {{$}}. Examples where the existence check fails:
> {noformat}
> $ dpkg --get-selections | grep -v deinstall | awk '{print $1}' | grep -e
> '^liblzo2-2' -e '^libsnappy-dev'
> liblzo2-2:amd64
> libsnappy-dev:amd64
> {noformat}
> This results in {{Installing package ...}} being logged, which is a bit
> confusing. Plus an unnecessary {{apt-get}} call, including wait for
> {{apt.lock}}, which the {{dpkg}} command was supposed to avoid. Once
> {{apt-get}} gets to run, it returns quickly.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)