From b828b2578462610bd3d29974f19e4f3235fb46ce Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 12 Nov 2014 09:28:27 -0800 Subject: [PATCH] Add a fips fact and use it for integration tests --- lib/ansible/module_utils/facts.py | 8 ++++++++ test/integration/roles/test_copy/tasks/main.yml | 6 +++--- test/integration/roles/test_stat/tasks/main.yml | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 09332e00be..5ceeb405d5 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -125,6 +125,7 @@ class Facts(object): self.get_cmdline() self.get_public_ssh_host_keys() self.get_selinux_facts() + self.get_fips_facts() self.get_pkg_mgr_facts() self.get_lsb_facts() self.get_date_time_facts() @@ -486,6 +487,13 @@ class Facts(object): 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): self.facts['date_time'] = {} diff --git a/test/integration/roles/test_copy/tasks/main.yml b/test/integration/roles/test_copy/tasks/main.yml index 2b671c122d..7da4d6ad32 100644 --- a/test/integration/roles/test_copy/tasks/main.yml +++ b/test/integration/roles/test_copy/tasks/main.yml @@ -61,7 +61,7 @@ assert: that: - "copy_result.md5sum == 'c47397529fe81ab62ba3f85e9f4c71f2'" - ignore_errors: True + when: ansible_fips != True - name: check the stat results of the file stat: path={{output_file}} @@ -83,7 +83,7 @@ assert: that: - "stat_results.stat.md5 == 'c47397529fe81ab62ba3f85e9f4c71f2'" - ignore_errors: True + when: ansible_fips != True - name: overwrite the file via same means copy: src=foo.txt dest={{output_file}} @@ -242,7 +242,7 @@ that: - 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 ' ' register: target_file_result diff --git a/test/integration/roles/test_stat/tasks/main.yml b/test/integration/roles/test_stat/tasks/main.yml index f34f77a936..0019fda2ae 100644 --- a/test/integration/roles/test_stat/tasks/main.yml +++ b/test/integration/roles/test_stat/tasks/main.yml @@ -66,4 +66,4 @@ - assert: that: - "stat_result.stat.md5 == '5eb63bbbe01eeed093cb22bb8f5acdc3'" - ignore_errors: True + when: ansible_fips != True