Skip to content

Commit

Permalink
Handle missing playbook run correctly (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexwhite authored Jan 22, 2024
1 parent 22f61fa commit 64a8092
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/remediations/fifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,9 @@ async function formatRHCRuns (rhcRuns, playbook_run_id) {
trace.event(`processing ${rhcRuns.data.length} runs...`);

for (const run of rhcRuns.data) {
trace.event(`rhcRuns: ${JSON.stringify(rhcRuns)}`); // TODO: delete me!
// get dispatcher run hosts
const runHostsFilter = createDispatcherRunHostsFilter(run.labels['playbook-run'], run.id);
const rhcRunHosts = await dispatcher.fetchPlaybookRunHosts(runHostsFilter, RHCRUNFIELDS);
trace.event(`playbook run hosts: ${JSON.stringify(rhcRunHosts)}`); // TODO: delete me!
// If host === 'localhost' then add to RHCDirect
if (_.get(rhcRunHosts, 'data[0][host]') === 'localhost') {
rhcDirect.playbook = run.url;
Expand All @@ -182,7 +180,7 @@ trace.event(`playbook run hosts: ${JSON.stringify(rhcRunHosts)}`); // TODO: dele
}

// else create a new sat executor
else {
else if (!_.isEmpty(rhcRunsHosts)) {
let satExecutor = {
name: 'RHC Satellite',
executor_id: playbook_run_id,
Expand Down
2 changes: 1 addition & 1 deletion src/remediations/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = function (router) {
.get(trace, openapi('getRemediationConnectionStatus'), rbacExecute, fifi2.connection_status);

router.route('/remediations/:id/playbook_runs')
.get(trace, openapi('listPlaybookRuns'), rbacRead, fifi.listPlaybookRuns)
.get(openapi('listPlaybookRuns'), rbacRead, fifi.listPlaybookRuns)
.post(openapi('runRemediation'), rbacExecute, fifi2.executePlaybookRuns);

router.route('/remediations/:id/playbook_runs/:playbook_run_id')
Expand Down

0 comments on commit 64a8092

Please sign in to comment.