Class: Reactor::Plans::DeleteGroup

Inherits:
CommonGroup show all
Defined in:
lib/reactor/plans/delete_group.rb

Constant Summary

Constants inherited from CommonGroup

CommonGroup::ALLOWED_PARAMS

Instance Method Summary collapse

Methods inherited from CommonGroup

#set

Methods included from Prepared

#error, #separate_arguments

Constructor Details

#initialize(*args) ⇒ DeleteGroup

Returns a new instance of DeleteGroup.



8
9
10
11
12
13
# File 'lib/reactor/plans/delete_group.rb', line 8

def initialize(*args)
  super()

  (name, _), options = separate_arguments(*args)
  @name = name || options[:name]
end

Instance Method Details

#migrate!Object



20
21
22
23
# File 'lib/reactor/plans/delete_group.rb', line 20

def migrate!
  group = Reactor::Cm::Group.get(@name)
  group.delete!
end

#prepare!Object



15
16
17
18
# File 'lib/reactor/plans/delete_group.rb', line 15

def prepare!
  error('name is nil') if @name.nil?
  error("group #{@name} does not exist") unless Reactor::Cm::Group.exists?(@name)
end