Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get os_family for RPM distros from the RPM macros #49930

Merged
merged 3 commits into from Oct 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions salt/grains/core.py
Expand Up @@ -46,6 +46,7 @@
import salt.utils.network
import salt.utils.path
import salt.utils.platform
import salt.utils.pkg.rpm
from salt.ext import six
from salt.ext.six.moves import range

Expand Down Expand Up @@ -1896,8 +1897,8 @@ def os_data():
# architecture.
if grains.get('os_family') == 'Debian':
osarch = __salt__['cmd.run']('dpkg --print-architecture').strip()
elif grains.get('os_family') == 'RedHat':
osarch = __salt__['cmd.run']('rpm --eval %{_host_cpu}').strip()
elif grains.get('os_family') in ['RedHat', 'Suse']:
osarch = salt.utils.pkg.rpm.get_osarch()
elif grains.get('os_family') in ('NILinuxRT', 'Poky'):
archinfo = {}
for line in __salt__['cmd.run']('opkg print-architecture').splitlines():
Expand Down
3 changes: 2 additions & 1 deletion salt/utils/pkg/rpm.py
Expand Up @@ -9,6 +9,7 @@
import datetime
import logging
import subprocess
import salt.utils.stringutils

# Import 3rd-party libs
from salt.ext import six
Expand Down Expand Up @@ -47,7 +48,7 @@ def get_osarch():
close_fds=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()[0]
return ret or 'unknown'
return salt.utils.stringutils.to_str(ret).strip() or 'unknown'


def check_32(arch, osarch=None):
Expand Down