Skip to content

Commit

Permalink
Merge pull request #5995 from carlosmmatos/fix_5048
Browse files Browse the repository at this point in the history
Update ansible additional when statement to fix issues with rules not being applied to vm's
  • Loading branch information
redhatrises authored Aug 19, 2020
2 parents d0891af + 366b8e9 commit 00dc6ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions ssg/build_remediations.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ def _get_rule_reference(self, ref_class):
def update_when_from_rule(self, to_update):
additional_when = ""
if self.associated_rule.platform == "machine":
additional_when = ('ansible_virtualization_role != "guest" '
'or ansible_virtualization_type != "docker"')
additional_when = 'ansible_virtualization_type not in ["docker", "lxc", "openvz"]'
to_update.setdefault("when", "")
new_when = ssg.yaml.update_yaml_list_or_string(to_update["when"], additional_when)
if not new_when:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/ssg-module/data/ansible-resolved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
stat:
path: /boot/grub2/grub.cfg
register: file_exists
when: ansible_virtualization_role != "guest" or ansible_virtualization_type != "docker"
when: ansible_virtualization_type not in ["docker", "lxc", "openvz"]
tags:
- file_owner_grub2_cfg
- medium_severity
Expand All @@ -22,7 +22,7 @@
owner: 0
when:
- file_exists.stat.exists
- ansible_virtualization_role != "guest" or ansible_virtualization_type != "docker"
- ansible_virtualization_type not in ["docker", "lxc", "openvz"]
tags:
- file_owner_grub2_cfg
- medium_severity
Expand Down

0 comments on commit 00dc6ef

Please # to comment.