1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add a fips fact and use it for integration tests

This commit is contained in:
Toshio Kuratomi 2014-11-12 09:28:27 -08:00
parent 5bc81f9ae7
commit b828b25784
3 changed files with 12 additions and 4 deletions

View file

@ -125,6 +125,7 @@ class Facts(object):
self.get_cmdline() self.get_cmdline()
self.get_public_ssh_host_keys() self.get_public_ssh_host_keys()
self.get_selinux_facts() self.get_selinux_facts()
self.get_fips_facts()
self.get_pkg_mgr_facts() self.get_pkg_mgr_facts()
self.get_lsb_facts() self.get_lsb_facts()
self.get_date_time_facts() self.get_date_time_facts()
@ -486,6 +487,13 @@ class Facts(object):
self.facts['selinux']['type'] = 'unknown' self.facts['selinux']['type'] = 'unknown'
def get_fips_facts(self):
self.facts['fips'] = False
data = get_file_content('/proc/sys/crypto/fips_enabled')
if data and data == '1':
self.facts['fips'] = True
def get_date_time_facts(self): def get_date_time_facts(self):
self.facts['date_time'] = {} self.facts['date_time'] = {}

View file

@ -61,7 +61,7 @@
assert: assert:
that: that:
- "copy_result.md5sum == 'c47397529fe81ab62ba3f85e9f4c71f2'" - "copy_result.md5sum == 'c47397529fe81ab62ba3f85e9f4c71f2'"
ignore_errors: True when: ansible_fips != True
- name: check the stat results of the file - name: check the stat results of the file
stat: path={{output_file}} stat: path={{output_file}}
@ -83,7 +83,7 @@
assert: assert:
that: that:
- "stat_results.stat.md5 == 'c47397529fe81ab62ba3f85e9f4c71f2'" - "stat_results.stat.md5 == 'c47397529fe81ab62ba3f85e9f4c71f2'"
ignore_errors: True when: ansible_fips != True
- name: overwrite the file via same means - name: overwrite the file via same means
copy: src=foo.txt dest={{output_file}} copy: src=foo.txt dest={{output_file}}
@ -242,7 +242,7 @@
that: that:
- stat_link_result.stat.islnk - stat_link_result.stat.islnk
- name: get the md5 of the link target - name: get the checksum of the link target
shell: sha1sum {{output_dir}}/follow_test | cut -f1 -sd ' ' shell: sha1sum {{output_dir}}/follow_test | cut -f1 -sd ' '
register: target_file_result register: target_file_result

View file

@ -66,4 +66,4 @@
- assert: - assert:
that: that:
- "stat_result.stat.md5 == '5eb63bbbe01eeed093cb22bb8f5acdc3'" - "stat_result.stat.md5 == '5eb63bbbe01eeed093cb22bb8f5acdc3'"
ignore_errors: True when: ansible_fips != True