mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-06 22:24:23 -07:00
Blanks
This commit is contained in:
parent
d448a63879
commit
8d357942f9
1 changed files with 6 additions and 4 deletions
|
@ -72,7 +72,7 @@ import hashlib
|
||||||
def get_exports(module, output_format, file_path="/etc/exports"):
|
def get_exports(module, output_format, file_path="/etc/exports"):
|
||||||
IP_ENTRY_PATTERN = re.compile(r'(\d+\.\d+\.\d+\.\d+)\(([^)]+)\)')
|
IP_ENTRY_PATTERN = re.compile(r'(\d+\.\d+\.\d+\.\d+)\(([^)]+)\)')
|
||||||
MAIN_LINE_PATTERN = re.compile(r'\s*(\S+)\s+(.+)')
|
MAIN_LINE_PATTERN = re.compile(r'\s*(\S+)\s+(.+)')
|
||||||
|
|
||||||
file_digests = {}
|
file_digests = {}
|
||||||
hash_algorithms = ['sha256', 'sha1', 'md5']
|
hash_algorithms = ['sha256', 'sha1', 'md5']
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ def get_exports(module, output_format, file_path="/etc/exports"):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
module.warn("Error calculating '{}' hash: {}".format(algo, ex))
|
module.warn("Error calculating '{}' hash: {}".format(algo, ex))
|
||||||
exports = {}
|
exports = {}
|
||||||
|
|
||||||
output_lines = []
|
output_lines = []
|
||||||
if file_content_bytes:
|
if file_content_bytes:
|
||||||
output_lines = file_content_bytes.decode('utf-8', errors='ignore').splitlines()
|
output_lines = file_content_bytes.decode('utf-8', errors='ignore').splitlines()
|
||||||
|
@ -110,7 +110,7 @@ def get_exports(module, output_format, file_path="/etc/exports"):
|
||||||
match = MAIN_LINE_PATTERN.match(line)
|
match = MAIN_LINE_PATTERN.match(line)
|
||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
folder = match.group(1)
|
folder = match.group(1)
|
||||||
rest = match.group(2)
|
rest = match.group(2)
|
||||||
|
|
||||||
|
@ -132,11 +132,13 @@ def get_exports(module, output_format, file_path="/etc/exports"):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'exports_info': exports,
|
'exports_info': exports,
|
||||||
'file_digest': file_digests # <--- Returning the dictionary of hashes
|
'file_digest': file_digests
|
||||||
}
|
}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="Error while processing exports: {}".format(e))
|
module.fail_json(msg="Error while processing exports: {}".format(e))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue