Class: Moose::Inventory::Operations::RemoveGroups
- Inherits:
-
Object
- Object
- Moose::Inventory::Operations::RemoveGroups
- Includes:
- OperationEventSupport
- Defined in:
- lib/moose_inventory/operations/remove_groups.rb
Overview
Removes top-level groups and their direct associations.
Instance Method Summary collapse
- #call(names:, recursive: false, dry_run: false) ⇒ Object
-
#initialize(context:) ⇒ RemoveGroups
constructor
A new instance of RemoveGroups.
Constructor Details
#initialize(context:) ⇒ RemoveGroups
Returns a new instance of RemoveGroups.
14 15 16 17 18 19 20 |
# File 'lib/moose_inventory/operations/remove_groups.rb', line 14 def initialize(context:) @context = context @cleanup = Moose::Inventory::Operations::GroupCleanup.new( context: context, emitter: method(:emit) ) end |
Instance Method Details
#call(names:, recursive: false, dry_run: false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/moose_inventory/operations/remove_groups.rb', line 22 def call(names:, recursive: false, dry_run: false) events = [] warning_count = 0 @dry_run = dry_run cleanup.dry_run = dry_run names.each do |name| warning_count += remove_group(name, events, recursive: recursive) end emit(events, :dry_run_summary) if dry_run operation_result(events: events, warning_count: warning_count) end |