Class: Arver::Action
- Inherits:
-
Object
show all
- Defined in:
- lib/arver/action.rb
Direct Known Subclasses
AdduserAction, CloseAction, CreateAction, DeluserAction, GCAction, InfoAction, InitialConfigAction, KeyInfoAction, ListAction, OpenAction, RefreshAction
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(target_list) ⇒ Action
Returns a new instance of Action.
6
7
8
|
# File 'lib/arver/action.rb', line 6
def initialize( target_list )
self.target_list= target_list
end
|
Instance Attribute Details
#generator ⇒ Object
Returns the value of attribute generator.
4
5
6
|
# File 'lib/arver/action.rb', line 4
def generator
@generator
end
|
#key ⇒ Object
Returns the value of attribute key.
4
5
6
|
# File 'lib/arver/action.rb', line 4
def key
@key
end
|
#keystore ⇒ Object
Returns the value of attribute keystore.
4
5
6
|
# File 'lib/arver/action.rb', line 4
def keystore
@keystore
end
|
#slot_of_target_user ⇒ Object
Returns the value of attribute slot_of_target_user.
4
5
6
|
# File 'lib/arver/action.rb', line 4
def slot_of_target_user
@slot_of_target_user
end
|
#target_list ⇒ Object
Returns the value of attribute target_list.
4
5
6
|
# File 'lib/arver/action.rb', line 4
def target_list
@target_list
end
|
#target_user ⇒ Object
Returns the value of attribute target_user.
4
5
6
|
# File 'lib/arver/action.rb', line 4
def target_user
@target_user
end
|
Instance Method Details
#execute_partition(partition) ⇒ Object
69
70
|
# File 'lib/arver/action.rb', line 69
def execute_partition( partition )
end
|
#load_key(partition) ⇒ Object
56
57
58
59
60
61
62
63
64
|
# File 'lib/arver/action.rb', line 56
def load_key( partition )
self.key= keystore.luks_key( partition )
if( key.nil? )
Arver::Log.error( "No permission on #{partition.path}. Skipping." )
return false
end
true
end
|
#needs_target_user? ⇒ Boolean
26
27
28
|
# File 'lib/arver/action.rb', line 26
def needs_target_user?
false
end
|
#new_key_generator ⇒ Object
30
31
32
|
# File 'lib/arver/action.rb', line 30
def new_key_generator
self.generator= Arver::KeyGenerator.new
end
|
#on_user(username) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/arver/action.rb', line 10
def on_user( username )
return true unless needs_target_user?
unless Arver::Config.instance.exists?(username)
Arver::Log.error( "No such user" )
return false
end
return false unless verify_key_on_target( username )
self.slot_of_target_user= Arver::Config.instance.slot( username )
self.target_user= username
true
end
|
#open_keystore ⇒ Object
34
35
36
37
|
# File 'lib/arver/action.rb', line 34
def open_keystore
self.keystore= Arver::Keystore.for( LocalConfig.instance.username )
keystore.load
end
|
#post_action ⇒ Object
46
47
|
# File 'lib/arver/action.rb', line 46
def post_action
end
|
#post_host(host) ⇒ Object
75
76
|
# File 'lib/arver/action.rb', line 75
def post_host( host )
end
|
#post_partition(partition) ⇒ Object
72
73
|
# File 'lib/arver/action.rb', line 72
def post_partition( partition )
end
|
#pre_action ⇒ Object
43
44
|
# File 'lib/arver/action.rb', line 43
def pre_action
end
|
#pre_host(host) ⇒ Object
49
50
|
# File 'lib/arver/action.rb', line 49
def pre_host( host )
end
|
#pre_partition(partition) ⇒ Object
66
67
|
# File 'lib/arver/action.rb', line 66
def pre_partition( partition )
end
|
#run_on(node) ⇒ Object
39
40
41
|
# File 'lib/arver/action.rb', line 39
def run_on( node )
node.run_action( self ) if node.target?( self.target_list )
end
|
#verify?(partition) ⇒ Boolean
52
53
54
|
# File 'lib/arver/action.rb', line 52
def verify?( partition )
true
end
|
#verify_key_on_target(username) ⇒ Object