mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
This commit is contained in:
parent
af914695e6
commit
caa0c9d4cc
3 changed files with 10 additions and 2 deletions
|
@ -94,6 +94,8 @@ class DistributionFiles:
|
|||
'Archlinux': 'Arch Linux'
|
||||
}
|
||||
|
||||
STRIP_QUOTES = r'\'\"\\'
|
||||
|
||||
def __init__(self, module):
|
||||
self.module = module
|
||||
|
||||
|
@ -110,6 +112,7 @@ class DistributionFiles:
|
|||
|
||||
def _parse_dist_file(self, name, dist_file_content, path, collected_facts):
|
||||
dist_file_dict = {}
|
||||
dist_file_content = dist_file_content.strip(DistributionFiles.STRIP_QUOTES)
|
||||
if name in self.SEARCH_STRING:
|
||||
# look for the distribution string in the data and replace according to RELEASE_NAME_MAP
|
||||
# only the distribution name is set, the version is assumed to be correct from distro.linux_distribution()
|
||||
|
|
|
@ -27,6 +27,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
|
|||
class LSBFactCollector(BaseFactCollector):
|
||||
name = 'lsb'
|
||||
_fact_ids = set()
|
||||
STRIP_QUOTES = r'\'\"\\'
|
||||
|
||||
def _lsb_release_bin(self, lsb_path, module):
|
||||
lsb_facts = {}
|
||||
|
@ -97,5 +98,9 @@ class LSBFactCollector(BaseFactCollector):
|
|||
if lsb_facts and 'release' in lsb_facts:
|
||||
lsb_facts['major_release'] = lsb_facts['release'].split('.')[0]
|
||||
|
||||
for k, v in lsb_facts.items():
|
||||
if v:
|
||||
lsb_facts[k] = v.strip(LSBFactCollector.STRIP_QUOTES)
|
||||
|
||||
facts_dict['lsb'] = lsb_facts
|
||||
return facts_dict
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue