Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 16f03fe

Browse files
committedFeb 16, 2021
Merge branch 'knobcone' into 'master'
Merge knobcone release branch to main branch. Closes VIYAARK-237 See merge request sassoftware/viya-ark!358
2 parents 44fc588 + 7142f39 commit 16f03fe

File tree

9 files changed

+181
-35
lines changed

9 files changed

+181
-35
lines changed
 

‎CHANGELOG.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
# Changelog for SAS Viya ARK
22

33
<!-- LATEST RELEASE START -->
4+
## Viya35-ark-1.12 - February 16, 2021
5+
- **Summary**:
6+
RHEL8 Support and bug fixes.
7+
- Issues addressed:
8+
- SAS Multi-Machine Service Utilties
9+
- VIYAARK-226 - MMSU: Validate RHEL8
10+
- SAS Viya Upgrade Tasks Playbooks
11+
- VIYAARK-227 - Validate RHEL8
12+
- VIYAARK-237 - Merge playbook using check_invalid_arguments which was removed in Ansible 2.10
13+
- VIYAARK-240 - Merge Playbook ConfigParser Python2 Python3 Compatibility ()
14+
- SAS Viya Pre-Installation Playbook
15+
- VIYAARK-218 - Fails on clientaliveinterval control even when you run the playbook with the exclude option. (GitHub Issue #69)
16+
- VIYAARK-224 - Validate RHEL8
17+
- VIYAARK-229 - Get the permissions of the directories TASK fails in checkmode
18+
- VIYAARK-232 - Check for RHEL8 compatibility packages
19+
- VIYAARK-238 - Support RHEL8 OS checks
20+
- SAS Viya Deployment Report
21+
- VIYAARK-225 - Validate RHEL8
22+
- VIYAARK-239 - UnicodeEncodeError: 'ascii' codec can't encode character correctly. (GitHub Issue #75)
23+
- Ansible Support: Ansible 2.8 - Ansible 2.10
24+
25+
<!-- LATEST RELEASE END -->
26+
427
## Viya35-ark-1.11 - December 18, 2020
528
- **Summary**:
629
Bug fixes and a couple of enhancments.
@@ -14,7 +37,6 @@
1437
- VIYAARK-222 - Archive Obsolete Log Folders Playbook Fails on Power Linux
1538
- Ansible Support: Ansible 2.8 - Ansible 2.10
1639

17-
<!-- LATEST RELEASE END -->
1840

1941
## Viya35-ark-1.10 - October 20, 2020
2042
- **Summary**:

‎playbooks/deployment-report/library/get_sas_host_details.py

+64-13
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# SPDX-License-Identifier: Apache-2.0
1111
#
1212
import os
13+
import sys
1314
import datetime
1415
import glob
1516
import subprocess
@@ -44,6 +45,12 @@
4445
This option will greatly increase the size of the data being returned.
4546
default: false
4647
required: false
48+
locale_encoding:
49+
description: >
50+
Encoding to use for text returned to the module that may be localized for the locale of the
51+
deployed software. The value must be an encoding supported by Python.
52+
default: None
53+
required: false
4754
'''
4855

4956
EXAMPLES = '''
@@ -57,6 +64,12 @@
5764
get_sas_host_details:
5865
hostvars: "{{ hostvars[inventory_hostname] }}"
5966
include_package_files: true
67+
68+
# Get SAS deployment information with custom locale encoding
69+
- name: Inspect SAS deployment
70+
get_sas_host_details:
71+
hostvars: "{{ hostvars[inventory_hostname] }}"
72+
locale_encoding: "macroman"
6073
'''
6174

6275
RETURN = '''
@@ -751,6 +764,7 @@ class _ModuleParamKeys(object):
751764
"""
752765
HOSTVARS = 'hostvars'
753766
INCL_PKG_FILES = 'include_package_files'
767+
LOCALE_ENCODING = 'locale_encoding'
754768

755769

756770
# =====
@@ -895,13 +909,15 @@ def main():
895909
# supports check mode
896910
module = AnsibleModule(
897911
argument_spec={_ModuleParamKeys.HOSTVARS: dict(type='raw', required=True),
898-
_ModuleParamKeys.INCL_PKG_FILES: dict(type=bool, default=False, required=False)},
912+
_ModuleParamKeys.INCL_PKG_FILES: dict(type=bool, default=False, required=False),
913+
_ModuleParamKeys.LOCALE_ENCODING: dict(type='str', default=None, required=False)},
899914
supports_check_mode=True
900915
)
901916

902917
# get module parameters
903918
hostvars = module.params[_ModuleParamKeys.HOSTVARS]
904919
include_package_files = module.params[_ModuleParamKeys.INCL_PKG_FILES]
920+
locale_encoding = module.params[_ModuleParamKeys.LOCALE_ENCODING]
905921

906922
# Starting in Ansible 2.8.1, there is the potential for hostvars
907923
# to be passed as a byte string, if the dict is too large
@@ -1435,26 +1451,27 @@ def _get_process_memory_info(pid, module):
14351451
# =====
14361452
# _get_sas_package_info(AnsibleModule, bool)
14371453
# =====
1438-
def _get_sas_package_info(module, package_manager, include_installed_files=False):
1454+
def _get_sas_package_info(module, package_manager, include_installed_files=False, locale_encoding=False):
14391455
"""
14401456
Retrieves package information for all installed SAS packages and returns the values as a dict.
14411457
14421458
:param AnsibleModule module: The AnsibleModule object representing the current module.
14431459
:param bool include_installed_files: Toggles whether information about the package's installed files should be
14441460
included.
1461+
:param locale_encoding: A custom locale encoding that should be used to decode potentially localized text.
14451462
:return: A dict of package names mapped to a dict containing package attribute names and their values.
14461463
:rtype dict:
14471464
"""
14481465

14491466
# -- package info -- #
14501467

14511468
# get installed package info via rpm
1452-
results = _get_installed_package_info(module, include_installed_files)
1469+
results = _get_installed_package_info(module, include_installed_files, locale_encoding)
14531470

14541471
if package_manager == _PackageManagers.ZYPPER:
1455-
update_results = _get_sas_package_update_info_zypper(module)
1472+
update_results = _get_sas_package_update_info_zypper(module, locale_encoding)
14561473
else:
1457-
update_results = _get_sas_package_update_info_yum(module)
1474+
update_results = _get_sas_package_update_info_yum(module, locale_encoding)
14581475

14591476
for package_name, update_info in update_results.items():
14601477
results[package_name][_HostDetailsKeys.SASPackageKeys.UPDATE_STATUS] = update_info
@@ -1466,13 +1483,14 @@ def _get_sas_package_info(module, package_manager, include_installed_files=False
14661483
# =====
14671484
# _get_installed_package_info(AnsibleModule)
14681485
# =====
1469-
def _get_installed_package_info(module, include_installed_files):
1486+
def _get_installed_package_info(module, include_installed_files, locale_encoding):
14701487
"""
14711488
Retrieves package information via rpm for all installed SAS Packages and returns the values as a dict.
14721489
14731490
:param module: The AnsibleModule object representing the current module.
14741491
:param bool include_installed_files: Toggles whether information about the package's installed files should be
14751492
included.
1493+
:param locale_encoding: A custom locale encoding that should be used to decode potentially localized text.
14761494
:return: A dict of package names mapped to a dict of package attributes and their values.
14771495
:rtype dict:
14781496
"""
@@ -1509,7 +1527,8 @@ def _get_installed_package_info(module, include_installed_files):
15091527
# get the package name (first line in each block of output)
15101528
try:
15111529
package_name_line = package_info_lines.pop(0)
1512-
package_name_attr = str(package_name_line).split(delim)
1530+
package_name_line = _decode_str(package_name_line, locale_encoding)
1531+
package_name_attr = package_name_line.split(delim)
15131532
if len(package_name_attr) == 2 and package_name_attr[0] == \
15141533
_HostDetailsKeys.SASPackageKeys.PackageAttributesKeys.NAME:
15151534
package_name = package_name_attr[1]
@@ -1528,7 +1547,8 @@ def _get_installed_package_info(module, include_installed_files):
15281547
for line in package_info_lines:
15291548

15301549
# split line by delimiter to get key and value
1531-
attr = str(line).split(delim)
1550+
line = _decode_str(line, locale_encoding)
1551+
attr = line.split(delim)
15321552

15331553
if len(attr) == 2:
15341554
key = attr[0]
@@ -1575,11 +1595,12 @@ def _get_installed_package_info(module, include_installed_files):
15751595
# =====
15761596
# _get_sas_package_update_info_yum(AnsibleModule)
15771597
# =====
1578-
def _get_sas_package_update_info_yum(module):
1598+
def _get_sas_package_update_info_yum(module, locale_encoding=None):
15791599
"""
15801600
Retrieves package information via yum for all installed SAS packages and returns the values as a dict.
15811601
15821602
:param AnsibleModule module: The AnsibleModule object representing the current module.
1603+
:param locale_encoding: A custom locale encoding that should be used to decode potentially localized text.
15831604
:return: A dict of package names mapped to a dict containing package attribute names and their values.
15841605
:rtype dict:
15851606
"""
@@ -1602,14 +1623,16 @@ def _get_sas_package_update_info_yum(module):
16021623
for line in all_update_info:
16031624

16041625
# skip empty lines
1605-
if not str(line).strip().startswith('sas-'):
1626+
line = _decode_str(line, locale_encoding)
1627+
if not line.strip().startswith('sas-'):
16061628
continue
16071629

16081630
# replace multiple consecutive whitespaces delim character
16091631
line = re.sub(' +', ':::', line)
16101632

16111633
# split line by delimiter to get key and value
1612-
attr = str(line).split(':::')
1634+
line = _decode_str(line, locale_encoding)
1635+
attr = line.split(':::')
16131636

16141637
if len(attr) == 3:
16151638
# define a dictionary to map package update attributes to their respective key
@@ -1629,11 +1652,12 @@ def _get_sas_package_update_info_yum(module):
16291652
# =====
16301653
# _get_sas_package_update_info_zypper(AnsibleModule)
16311654
# =====
1632-
def _get_sas_package_update_info_zypper(module):
1655+
def _get_sas_package_update_info_zypper(module, locale_encoding=None):
16331656
"""
16341657
Retrieves package information via zypper for all installed SAS packages and returns the values as a dict.
16351658
16361659
:param AnsibleModule module: The AnsibleModule object representing the current module.
1660+
:param locale_encoding: A custom locale encoding that should be used to decode potentially localized text.
16371661
:return: A dict of package names mapped to a dict containing package attribute names and their values.
16381662
:rtype dict:
16391663
"""
@@ -1658,7 +1682,8 @@ def _get_sas_package_update_info_zypper(module):
16581682
line = re.sub(' +', ' ', line)
16591683

16601684
# split line by delimiter to get key and value
1661-
attr = str(line).split(" | ")
1685+
line = _decode_str(line, locale_encoding)
1686+
attr = line.split(" | ")
16621687

16631688
if len(attr) == 6:
16641689
# define a dictionary to map package update attributes to their respective key
@@ -1784,6 +1809,32 @@ def _bytesHumanReadable(num_bytes, unit_step=1024.0):
17841809
return str(num_bytes) + ' ' + unit
17851810

17861811

1812+
# =====
1813+
# Handle decoding strings that may contain encoded characters
1814+
# =====
1815+
def _decode_str(value, locale_encoding=None):
1816+
# no need to decode in Python3
1817+
if sys.version_info[0] >= 3:
1818+
return value
1819+
1820+
# encodings to try
1821+
encodings = ['ascii', 'utf-8', 'iso-8859-1']
1822+
1823+
for encoding in encodings:
1824+
try:
1825+
return value.decode(encoding).encode('utf-8')
1826+
except UnicodeDecodeError:
1827+
pass
1828+
1829+
# try the provided locale encoding if none of the default encodings worked
1830+
if locale_encoding is not None:
1831+
# if this raises an error, let it surface to make it known that the provided value wasn't accepted
1832+
return value.decode(locale_encoding).encode('utf-8')
1833+
1834+
# if no strict decode worked, decode to utf-8 and ignore unknown chars
1835+
return value.decode('utf-8', 'ignore').encode('utf-8')
1836+
1837+
17871838
# =====
17881839
# Script entry point
17891840
# =====

‎playbooks/merge-playbook/library/merge_viya_deployment_files.py

+29-12
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,35 @@ def read_inventory(inv_file, comments):
166166
with open(tmp_file_name, 'w') as tmp_file:
167167
tmp_file.writelines(i.replace('#', '#') for i in current_file.readlines())
168168

169-
inv_parser = configparser.ConfigParser(allow_no_value=True)
170-
inv_parser.optionxform = lambda option: option # preserve as case-sensitive
171-
try:
172-
inv_parser.read(tmp_file_name)
173-
except configparser.MissingSectionHeaderError:
174-
# need to inject [host-definitions] inventory section header to parse it
175-
try_again = six.StringIO()
176-
try_again.write('[host-definitions]\n')
177-
try_again.write(open(tmp_file_name).read())
178-
try_again.seek(0, os.SEEK_SET)
179-
inv_parser.readfp(try_again)
169+
# configparser compatability issues between python 2 and python 3 around strict
170+
# parameter and DuplicateOptionError needs differential usage. Changes were added
171+
# to python 3.2.
172+
if sys.version_info.major == 3 and sys.version_info.minor >= 2:
173+
# python version greater than or equal to 3.2
174+
inv_parser = configparser.ConfigParser(strict=False, allow_no_value=True)
175+
inv_parser.optionxform = lambda option: option # preserve as case-sensitive
176+
try:
177+
inv_parser.read(tmp_file_name)
178+
except (configparser.MissingSectionHeaderError, configparser.DuplicateOptionError):
179+
# need to inject [host-definitions] inventory section header to parse it
180+
try_again = six.StringIO()
181+
try_again.write('[host-definitions]\n')
182+
try_again.write(open(tmp_file_name).read())
183+
try_again.seek(0, os.SEEK_SET)
184+
inv_parser.readfp(try_again)
185+
else:
186+
# python version less than 3.2
187+
inv_parser = configparser.ConfigParser(allow_no_value=True)
188+
inv_parser.optionxform = lambda option: option # preserve as case-sensitive
189+
try:
190+
inv_parser.read(tmp_file_name)
191+
except (configparser.MissingSectionHeaderError):
192+
# need to inject [host-definitions] inventory section header to parse it
193+
try_again = six.StringIO()
194+
try_again.write('[host-definitions]\n')
195+
try_again.write(open(tmp_file_name).read())
196+
try_again.seek(0, os.SEEK_SET)
197+
inv_parser.readfp(try_again)
180198

181199
return inv_parser
182200

@@ -521,7 +539,6 @@ def main():
521539
"merge_default_host": {"required": False, "type": "str"},
522540
}
523541
module = AnsibleModule(argument_spec=fields,
524-
check_invalid_arguments=True,
525542
supports_check_mode=True)
526543

527544
current_inventory_file = module.params['current_inventory_file']

‎playbooks/pre-install-playbook/roles/viya-ark.preinstall/defaults/main.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2019-2020, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
2+
# Copyright (c) 2019-2021, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
---
@@ -12,6 +12,9 @@ os_major_version_1: 7
1212
os_major_minor_version_1: 7.1
1313
os_major_version_2: 6
1414
os_major_minor_version_2: 6.7
15+
os_major_version_3: 8
16+
os_major_minor_version_3: 8.0
17+
1518
suse_os_major_version: 12
1619
suse_os_major_minor_version: 12.2
1720

@@ -166,6 +169,11 @@ required_package_versions_rhel:
166169
- { name: curl, value: 7.19.7-53 }
167170
- { name: nss.x86_64, value: 3.36.0-7 }
168171

172+
compat_packages:
173+
- compat-openssl10
174+
- authselect-compat
175+
- ncurses-compat-libs
176+
169177
##
170178
## SAS YUM repos.
171179
##

‎playbooks/pre-install-playbook/roles/viya-ark.preinstall/tasks/pre.os_version_check.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
- ansible_os_family == redhat_os_name or ansible_os_family == suse_os_name
2323
msg: |
2424
The OS of this server is not supported.
25-
Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} ) or {{suse_os_name}} at least version {{suse_os_major_minor_version}}
25+
Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}} or {{os_major_version_3}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} or {{os_major_minor_version_3}} ) or {{suse_os_name}} at least version {{suse_os_major_minor_version}}
2626
You seem to have {{ansible_os_family}} {{ansible_distribution_version}}
2727
2828
- name: Ensure that the Operating System version is supported when on RedHat (this includes Oracle Linux)
@@ -32,17 +32,23 @@
3232
- ansible_distribution_major_version is version(os_major_version_1, '==')
3333
or
3434
ansible_distribution_major_version is version(os_major_version_2, '==')
35-
# at least 6.7 if 6 or at least 7.1 if 7
35+
or
36+
ansible_distribution_major_version is version(os_major_version_3, '==')
37+
# at least 6.7 if 6 or at least 7.1 if 7 or at least 8.0 if 8
3638
- (ansible_distribution_major_version is version(os_major_version_1, '==')
3739
and
3840
ansible_distribution_version is version(os_major_minor_version_1, '>='))
3941
or
4042
(ansible_distribution_major_version is version(os_major_version_2, '==')
4143
and
4244
ansible_distribution_version is version(os_major_minor_version_2, '>='))
45+
or
46+
(ansible_distribution_major_version is version(os_major_version_3, '==')
47+
and
48+
ansible_distribution_version is version(os_major_minor_version_3, '>='))
4349
msg: |
4450
The OS of this server is not supported.
45-
Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} )
51+
Viya requires {{redhat_os_name}} {{os_major_version_1}}, {{os_major_version_2}} or {{os_major_version_3}}, (at least {{os_major_minor_version_1}}, {{os_major_minor_version_2}} or {{os_major_minor_version_3}} )
4652
You seem to have {{ansible_os_family}} {{ansible_distribution_version}}
4753
when: ansible_os_family == redhat_os_name
4854

There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.