[BOLT-1337] Make .filter_set called on a ResultSet return a ResultSet Created: 2019/05/23  Updated: 2019/05/30  Resolved: 2019/05/29

Status: Resolved
Project: Puppet Task Runner
Component/s: None
Affects Version/s: None
Fix Version/s: BOLT 1.21.0

Type: Improvement Priority: Normal
Reporter: Reid Vandewiele Assignee: Lucy Wyman
Resolution: Fixed Votes: 0
Labels: docs, docs_reviewed
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Sprint: Bolt Kanban
Release Notes: Enhancement
Release Notes Summary: A {{filter_set}} function has been added to the {{ResultSet}} data type which filters a {{ResultSet}} with a lambda to return a {{ResultSet}} object.
QA Risk Assessment: Needs Assessment

 Description   

This should work. It doesn’t, because filter called on a ResultSet returns an array.

# Identify those nodes that need to be rebooted.
$reboot_targets = $patch_results.ok_set.filter |$result| {
  $result['reboot_flag'] == true
}.targets

Make a new method, .filter_set, which when called on a ResultSet returns a ResultSet. Making a new method instead of just fixing .filter because of concerns over breaking / backwards incompatible changes.



 Comments   
Comment by Lucy Wyman [ 2019/05/29 ]

Melissa Amos The first looks good! The second looks like it doesn't have filter_set on it, but might also just be linked wrong?

Comment by Lucy Wyman [ 2019/05/30 ]

LGTM!

Generated at Fri Dec 13 07:18:56 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.