Skip to content

Commit

Permalink
RHINENG-7643: add unit tests for errata with 6 digit id (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
marleystipich2 authored Jan 17, 2024
1 parent 13da8bb commit 77038c8
Show file tree
Hide file tree
Showing 6 changed files with 269 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/connectors/patchman/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ const ERRATA = {
id: 'RHBA-2019:2871',
type: 'advisory'
},
'RHBA-2024:101234': {
attributes: {
description: 'The sudo packages contain the sudo utility which allows system administrators to provide certain users with the permission to execute privileged commands, which are used for system management purposes, without having to log in as root.\n\nSecurity Fix(es):\n\n* A flaw was found in the way sudo parsed tty information from the process status file in the proc filesystem. A local user with privileges to execute commands via sudo could use this flaw to escalate their privileges to root. (CVE-2017-1000367)\n\nRed Hat would like to thank Qualys Security for reporting this issue.',
synopsis: 'sudo update',
reboot_required: false
},
id: 'RHBA-2024:101234',
type: 'advisory'
},
'RHSA-2019:1873': {
attributes: {
description: 'Important: kernel security, bug fix and enhancement update',
Expand Down
3 changes: 3 additions & 0 deletions src/connectors/vmaas/mock.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 138 additions & 0 deletions src/generator/__snapshots__/errata.integration.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,144 @@ exports[`aggregates multiple errata-based issues into advisory/cve plays 1`] = `
changed_when: false"
`;

exports[`generates a simple playbook with RHBA remediation with a 6-digit id 1`] = `
"---
# Red Hat Insights has recommended one or more actions for you, a system administrator, to review and if you
# deem appropriate, deploy on your systems running Red Hat software. Based on the analysis, we have automatically
# generated an Ansible Playbook for you. Please review and test the recommended actions and the Playbook as
# they may contain configuration changes, updates, reboots and/or other changes to your systems. Red Hat is not
# responsible for any adverse outcomes related to these recommendations or Playbooks.
# Apply RHBA-2024:101234
# Identifier: (vulnerabilities:RHBA-2024:101234,fix)
# Version: test
- name: update packages
hosts: \\"53fbcd90-9c8f-11e8-98d0-529269fb1459.example.com\\"
vars:
insights_issues: \\"--advisory RHBA-2024:101234\\"
requires_reboot: \\"true\\"
insights_signature_exclude: \\"/hosts,/vars/insights_signature,/vars/insights_issues,/vars/requires_reboot\\"
insights_signature: !!binary |
TFMwdExTMUNSVWRKVGlCUVIxQWdVMGxIVGtGVVZWSkZMUzB0TFMwS1ZtVnljMmx2YmpvZ1IyNTFV
RWNnZGpFS0NtbFJTV05DUVVGQ1EwRkJSMEpSU214dlJqY3pRVUZ2U2tWTmRuYzFPRVFyYWpWd1Rt
TnhVVkF2TVhGTGFDOW5ZVk5YTTFNME5VVjNla2haU21kUWF5c0tabXczTUdvNVRtbElRalIzVVVO
SWExSm5OVlE0SzNJd1FsWndhRE13UjFWb2FEVk9NV1ZRVVVGSFNHcENSbXhWV0RSSlJEaG9SbTVM
TjFJMVpteHhhQXBIZDJ4UmFVRkhNakZQTVVVM1N6bFdUbXhtY21oSVIxUTVXak5zVG14UldWaFpP
SEl6Y201VWMyRnBlWEowZWsxMGRYUkJOR2hKUjBJd1RsaFlaMVl2Q2xadFNHbFVRbkJCWkVsR2VY
ZzVVRVZtVlZaUWRsUkVieXQ1YURsRFptSndkVEJyVkVaVE1sWkRhRFo1WTFKWU1rZFJjbXBMY0Zn
MFIzSjFlRzlEYXpnS2IyRlFWMlJYVHpVeWFXSlljM1JNZFVsUlJGRlZjR0Z4UlUxdFJFaEtUalpG
Y2xSQlYxZEhRbEZFZVdsWVVtRjZaa1pTUjJZeU5Xc3JWM2xuVTFSM2FRb3JORUY2ZFVScmEzRlFj
M3BZVTBOSmJESk1kWGxoYjBSRE9HcDVNSHA2YkUwNFEzUndXU3RJWjBkR2IwOUVka0k1TTNJd01I
WnpNemxFWkdwYVNsVjZDbEZXTkUxNE5tOUpkMVoyZEVSbGFqSXZZMWMwTldkelVXc3lUMlpxY1hS
RlNHNUNhVWREU20wMmFIcFRUM1psYzFKdGVEaEVlWGxYVVZGUVdEWTVUV1VLYTJkYU5WQlNPV05S
YjNSd2FVWlpPV2xOZVdOUmRraFlWRU5qUjI5VU1tMWhaV2hKU1RWVVNuUlNSVnB0Um5BeFVrZFNS
emRIVHpCRE0ydEZNbGxhTndwamJXTnhNazFRUkRObVMxUnFRMlppV21rMGVFcFNablUxYW5keFdu
VTBaVzVhTm1SV1YxaG5ObVpGVFN0TVZuaEZWMGhDYzNKalRtSlRNR0ZuTUdaTkNsWjBTMjVZWWxC
NlJHOTVPV1p5SzNobE5HY3dkbEJEUlhCVmJVOU5SeTg0Y2xaTmVuWmxjR00xVFhOcVZWaHJRa3c0
TWs1NE1YSTRSVXgxTWpCWllWa0tRblpvVnpsTmNraGhlVEZtVms1bVNGUnVPRGd5UkZCU2JqaE1j
VGhOYVdkM1kydDZWa1I0VUc5YWF6VldjV1FyUVdsMmJrVlBjMlk1YW5Ka2VHMTNOQXBKWVdrNFpH
OU5aV1kwTTNsNWNXVnZjbEZLZUFvOVpWWkZTQW90TFMwdExVVk9SQ0JRUjFBZ1UwbEhUa0ZVVlZK
RkxTMHRMUzBL
become: true
tasks:
- name: check for update
shell: \\"{{ ansible_facts['pkg_mgr'] }} check-update -q {{ insights_issues | regex_search('(--advisory ((FEDORA-EPEL-[\\\\\\\\w-]+)|(RH[SBE]A-20[\\\\\\\\d]{2}:[\\\\\\\\d]{4,6}))\\\\\\\\s*)+') }}\\"
check_mode: no
register: check_out
failed_when: check_out.rc != 0 and check_out.rc != 100
- when: check_out.rc == 100
name: upgrade package
shell: \\"{{ ansible_facts['pkg_mgr'] }} update -d 2 -y {{ insights_issues | regex_search('(--advisory ((FEDORA-EPEL-[\\\\\\\\w-]+)|(RH[SBE]A-20[\\\\\\\\d]{2}:[\\\\\\\\d]{4,6}))\\\\\\\\s*)+') }}\\"
- when: check_out.rc == 100
name: set reboot fact
set_fact:
insights_needs_reboot: \\"{{requires_reboot}}\\"
# Reboots a system if any of the preceeding plays sets the 'insights_needs_reboot' variable to true.
# The variable can be overridden to suppress this behavior.
- name: Reboot system (if applicable)
hosts: \\"53fbcd90-9c8f-11e8-98d0-529269fb1459.example.com\\"
become: true
gather_facts: false
vars:
insights_signature_exclude: /hosts,/vars/insights_signature
insights_signature: !!binary |
TFMwdExTMUNSVWRKVGlCUVIxQWdVMGxIVGtGVVZWSkZMUzB0TFMwS1ZtVnljMmx2YmpvZ1IyNTFV
RWNnZGpFS0NtbFJTVlpCZDFWQldVaHBRMVk0ZG5jMU9FUXJhalZ3VGtGUmFrMUVRa0ZCYTJOeE1W
WlhVbEF3VUVoMGRIRjBWMGt4UkZSdU4zcE1kbFUyU0hKd2QxSUtUbkJ3Um5SWGJWRktiM2xxYm1w
bE5XUmFSemMxUTNCU1kzZGFPRU5XVW5sRlRVRXpVREExZW1Kc1UzSnFWbTUxVW5oNlpVeG1SbTFy
YW1SRVJWcHdjZ3ByWTJ0d2FFazJSVUpIYWtJemEyaGFUalJ5YTNwUWRWQm1PR1pMUVdsSE1ESmxk
SGhXVFZWV01tZHRkV3c0UjBJMmRIcEpkRk5uVFRGQlFYQkdORTFRQ2s1NFRDOUpUMlY2ZFdRMGFt
VlFaV05KZWpGS1dtMTVkVGgzWTNoVFZqWkpTbTVPU1VGSGVHYzVWRUpVYzNNMFEwbHVaVlZXY0RG
VWRrUlFPUzlHVXk4S2VGaFlaMFphWlM5VlZuQjBaRzA1ZDJkbmRVOXRiR2hvWVZCTVZHNU5Tbkoy
UVRsV2FVUnZRVzV2WWt0b1VIbEtZMHBSYjJOTFdrRlRjVTF6ZWs1VWNncHVNek5JYlRoUk9IQnRW
VTFLYldobU9VRnZkM2x4VW5GWVVHeHpXVGwzT0UxRU1WQkZjR3htY2pJeVlYTjFMMHhvYjNGNlIz
TmtOMUUxTTJwdFMyNXBDaXM1Y0VjeWEzVkNSVXhpVVhoblRHcERiVlZsUzFCdmJuaFhjM0JuVFZs
M2VYQjFaVFJvYnl0dmFsZG5WRGR2ZG1GbFRFNVRTMkV2UkZOS2JEWldRaThLZEd4YUwxUXJPRFZr
Ym5ZclNWb3phbEJTZFM5bVpuZFBkVVpVV2xoNmVGTkJUalZSV1M5ak15c3hhbUZSTDBKeFdYTmhi
M2RpUkZreGRXUXZVeXRsYVFwa2FEa3JWRkV5TlVKa1NYa3hibGh3ZWpoV1JHbHpjbEp3Y0VrNWFs
SldWakkwTVVVelRVWkhka1ZaTm1aVFYzSlZWMWMzY0RKbFpUbGphelpOVlUweUNrNUZjRXBLWm5G
UFNFdHBjRXRPZVRKdVFVRTJURmcxTHpNeGFWSk9VSEZZVXpKRVdqSlpkbVZTUTJOMmVDOHZPVTlo
UzFWd1FsZElZVmxYYW5STU4wWUtSWFJWVEZGeFZESkJPVTF3WjFSU1RtOU5WbEZ4Y1haQ01GUlBP
WE00TmxoTmRuUkdRa1IzYW5SbWIxSm9NRnBEYlUwME1FRlhRMHBxT0RKNlduTlRZUXBCYXpkUEsy
UkpkMFl5VVQwS1BWcEtiallLTFMwdExTMUZUa1FnVUVkUUlGTkpSMDVCVkZWU1JTMHRMUzB0Q2c9
PQ==
tasks:
- when:
- insights_needs_reboot is defined
- insights_needs_reboot
block:
- name: Reboot system
shell: sleep 2 && shutdown -r now \\"Ansible triggered reboot\\"
async: 1
poll: 0
ignore_errors: true
- name: Wait for system to boot up
local_action:
module: wait_for
host: \\"{{ hostvars[inventory_hostname]['ansible_host'] | default(hostvars[inventory_hostname]['ansible_ssh_host'], true) | default(inventory_hostname, true) }}\\"
port: \\"{{ hostvars[inventory_hostname]['ansible_port'] | default(hostvars[inventory_hostname]['ansible_ssh_port'], true) | default('22', true) }}\\"
delay: 15
search_regex: OpenSSH
timeout: 300
become: false
- name: run insights
hosts: \\"53fbcd90-9c8f-11e8-98d0-529269fb1459.example.com\\"
become: true
gather_facts: false
vars:
insights_signature_exclude: /hosts,/vars/insights_signature
insights_signature: !!binary |
TFMwdExTMUNSVWRKVGlCUVIxQWdVMGxIVGtGVVZWSkZMUzB0TFMwS1ZtVnljMmx2YmpvZ1IyNTFV
RWNnZGpFS0NtbFJTVlpCZDF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kVlZJWWpS
ME5EVTFSSE5EWlZWc1ZEZFNOakJDTTB4d1Z6TmlTRTF0YzFCMEx6RktNRFEwYm1KS2RFTkhUM1Jy
UVVWWVRsVTJlbGxUTDNBMFFqSUtaSFYxY2tZdlNHUnFWWFJNVDNSdlNFTnlZVWd2WkZwaFRVNTZk
MVZpZUc1VFZXUkdZU3R6TTBaNFJHczFVVkU0VVRaMVVucFpRbWw0WkcxeWREZGpUQXBKYTA1NlEy
aHBRMDlrY3owS1BVMVZOMk1LTFMwdExTMUZUa1FnVUVkUUlGTkpSMDVCVkZWU1JTMHRMUzB0Q2c9
PQ==
tasks:
- name: run insights
command: insights-client
changed_when: false"
`;

exports[`generates a simple playbook with multiple erratum-based remediation 1`] = `
"---
# Red Hat Insights has recommended one or more actions for you, a system administrator, to review and if you
Expand Down
88 changes: 88 additions & 0 deletions src/generator/__snapshots__/patchman.integration.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,94 @@ exports[`patchman generates a playbook including EPEL advisory 1`] = `
changed_when: false"
`;

exports[`patchman generates a playbook with patchman advisory remediation with a 6-digit id 1`] = `
"---
# Red Hat Insights has recommended one or more actions for you, a system administrator, to review and if you
# deem appropriate, deploy on your systems running Red Hat software. Based on the analysis, we have automatically
# generated an Ansible Playbook for you. Please review and test the recommended actions and the Playbook as
# they may contain configuration changes, updates, reboots and/or other changes to your systems. Red Hat is not
# responsible for any adverse outcomes related to these recommendations or Playbooks.
# Apply RHBA-2024:101234
# Identifier: (patch-advisory:RHBA-2024:101234,fix)
# Version: test
- name: update packages
hosts: \\"68799a02-8be9-11e8-9eb6-529269fb1459.example.com\\"
vars:
insights_issues: \\"--advisory RHBA-2024:101234\\"
requires_reboot: \\"false\\"
insights_signature_exclude: \\"/hosts,/vars/insights_signature,/vars/insights_issues,/vars/requires_reboot\\"
insights_signature: !!binary |
TFMwdExTMUNSVWRKVGlCUVIxQWdVMGxIVGtGVVZWSkZMUzB0TFMwS1ZtVnljMmx2YmpvZ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uTUdaTkNsWjBTMjVZWWxC
NlJHOTVPV1p5SzNobE5HY3dkbEJEUlhCVmJVOU5SeTg0Y2xaTmVuWmxjR00xVFhOcVZWaHJRa3c0
TWs1NE1YSTRSVXgxTWpCWllWa0tRblpvVnpsTmNraGhlVEZtVms1bVNGUnVPRGd5UkZCU2JqaE1j
VGhOYVdkM1kydDZWa1I0VUc5YWF6VldjV1FyUVdsMmJrVlBjMlk1YW5Ka2VHMTNOQXBKWVdrNFpH
OU5aV1kwTTNsNWNXVnZjbEZLZUFvOVpWWkZTQW90TFMwdExVVk9SQ0JRUjFBZ1UwbEhUa0ZVVlZK
RkxTMHRMUzBL
become: true
tasks:
- name: check for update
shell: \\"{{ ansible_facts['pkg_mgr'] }} check-update -q {{ insights_issues | regex_search('(--advisory ((FEDORA-EPEL-[\\\\\\\\w-]+)|(RH[SBE]A-20[\\\\\\\\d]{2}:[\\\\\\\\d]{4,6}))\\\\\\\\s*)+') }}\\"
check_mode: no
register: check_out
failed_when: check_out.rc != 0 and check_out.rc != 100
- when: check_out.rc == 100
name: upgrade package
shell: \\"{{ ansible_facts['pkg_mgr'] }} update -d 2 -y {{ insights_issues | regex_search('(--advisory ((FEDORA-EPEL-[\\\\\\\\w-]+)|(RH[SBE]A-20[\\\\\\\\d]{2}:[\\\\\\\\d]{4,6}))\\\\\\\\s*)+') }}\\"
- when: check_out.rc == 100
name: set reboot fact
set_fact:
insights_needs_reboot: \\"{{requires_reboot}}\\"
- name: run insights
hosts: \\"68799a02-8be9-11e8-9eb6-529269fb1459.example.com\\"
become: true
gather_facts: false
vars:
insights_signature_exclude: /hosts,/vars/insights_signature
insights_signature: !!binary |
TFMwdExTMUNSVWRKVGlCUVIxQWdVMGxIVGtGVVZWSkZMUzB0TFMwS1ZtVnljMmx2YmpvZ1IyNTFV
RWNnZGpFS0NtbFJTVlpCZDFWQldVaHBRaXR6ZG5jMU9FUXJhalZ3VGtGUmFXdDRaeTh2WmtaRFoz
QXlTblIxVEd0UU5qQn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m1KS2RFTkhUM1Jy
UVVWWVRsVTJlbGxUTDNBMFFqSUtaSFYxY2tZdlNHUnFWWFJNVDNSdlNFTnlZVWd2WkZwaFRVNTZk
MVZpZUc1VFZXUkdZU3R6TTBaNFJHczFVVkU0VVRaMVVucFpRbWw0WkcxeWREZGpUQXBKYTA1NlEy
aHBRMDlrY3owS1BVMVZOMk1LTFMwdExTMUZUa1FnVUVkUUlGTkpSMDVCVkZWU1JTMHRMUzB0Q2c9
PQ==
tasks:
- name: run insights
command: insights-client
changed_when: false"
`;

exports[`patchman generates a simple playbook with multiple patchman advisory remediations 1`] = `
"---
# Red Hat Insights has recommended one or more actions for you, a system administrator, to review and if you
Expand Down
15 changes: 15 additions & 0 deletions src/generator/errata.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ test('generates a simple playbook with multiple erratum-based remediation', asyn
expect(res.text).toMatchSnapshot();
});

test('generates a simple playbook with RHBA remediation with a 6-digit id', async () => {
const data = {
issues: [{
id: 'vulnerabilities:RHBA-2024:101234',
systems: ['53fbcd90-9c8f-11e8-98d0-529269fb1459']
}]
};

const res = await request
.post('/v1/playbook')
.send(data)
.expect(200);
expect(res.text).toMatchSnapshot();
});

test('aggregates multiple errata into a single play', async () => {
const data = {
issues: [{
Expand Down
16 changes: 16 additions & 0 deletions src/generator/patchman.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ describe('patchman', function () {
expect(res.text).toMatchSnapshot();
});

test('generates a playbook with patchman advisory remediation with a 6-digit id', async () => {
const data = {
issues: [{
id: 'patch-advisory:RHBA-2024:101234',
systems: ['68799a02-8be9-11e8-9eb6-529269fb1459']
}]
};

const res = await request
.post('/v1/playbook')
.send(data)
.expect(200);

expect(res.text).toMatchSnapshot();
});

test('generates a playbook including EPEL advisory', async () => {
const data = {
issues: [{
Expand Down

0 comments on commit 77038c8

Please sign in to comment.