Class: Arver::DeluserAction

Inherits:
Action
  • Object
show all
Defined in:
lib/arver/deluser_action.rb

Instance Attribute Summary

Attributes inherited from Action

#generator, #key, #keystore, #slot_of_target_user, #target_list, #target_user

Instance Method Summary collapse

Methods inherited from Action

#load_key, #new_key_generator, #on_user, #open_keystore, #post_action, #post_host, #post_partition, #pre_action, #pre_host, #pre_partition, #run_on

Constructor Details

#initialize(target_list) ⇒ DeluserAction

Returns a new instance of DeluserAction.



3
4
5
6
# File 'lib/arver/deluser_action.rb', line 3

def initialize( target_list )
  super( target_list )
  self.open_keystore
end

Instance Method Details

#execute_partition(partition) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/arver/deluser_action.rb', line 24

def execute_partition( partition )
  Arver::Log.info( "remove user user #{target_user} (slot-no #{slot_of_target_user.to_s}) from #{partition.path}" )
  
  caller = Arver::LuksWrapper.killSlot( slot_of_target_user.to_s, partition )
  caller.execute( key )
  unless( caller.success? )
    Arver::Log.error( "Could not remove user:\n" + caller.output )
  end
end

#needs_target_user?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/arver/deluser_action.rb', line 8

def needs_target_user?
  true
end

#verify?(partition) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
# File 'lib/arver/deluser_action.rb', line 16

def verify?( partition )
  unless( load_key( partition ) )
    Arver::Log.error( "No permission on " + partition.path )
    return false
  end
  true
end

#verify_key_on_target(username) ⇒ Object



11
12
13
14
# File 'lib/arver/deluser_action.rb', line 11

def verify_key_on_target( username )
  #del user needs no key, slot number is enough
  true
end