Class: Arver::CloseAction
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
#initialize, #load_key, #needs_target_user?, #new_key_generator, #on_user, #open_keystore, #post_action, #pre_action, #run_on, #verify_key_on_target
Constructor Details
This class inherits a constructor from Arver::Action
Instance Method Details
#execute_partition(partition) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/arver/close_action.rb', line 12
def execute_partition( partition )
Arver::Log.info( "closing: "+partition.path )
caller = Arver::LuksWrapper.close( partition )
unless( caller.execute )
Arver::Log.error( "Aborting: Something went wrong when closing "+partition.name+":\n"+caller.output )
throw( :abort_action )
end
end
|
#post_host(host) ⇒ Object
51
52
53
54
55
56
57
58
59
|
# File 'lib/arver/close_action.rb', line 51
def post_host( host )
return if host.post_close.nil?
Arver::Log.info( "Running script: " + host.post_close + " on " + host.name )
c = Arver::SSHCommandWrapper.create( host.post_close, [] , host, true )
unless c.execute
Arver::Log.error( "Aborting: post_close on #{host.name} failed:\n"+c.output )
throw( :abort_action )
end
end
|
#post_partition(partition) ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/arver/close_action.rb', line 41
def post_partition( partition )
return if partition.post_close.nil?
Arver::Log.info( "Running script: " + partition.post_close + " on " + partition.parent.name )
c = Arver::SSHCommandWrapper.create( partition.post_close, [] , partition.parent, true )
unless c.execute
Arver::Log.error( "Aborting: post_close on #{partition.name} failed:\n"+c.output )
throw( :abort_action )
end
end
|
#pre_host(host) ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/arver/close_action.rb', line 21
def pre_host( host )
return if host.pre_close.nil?
Arver::Log.info( "Running script: " + host.pre_close + " on " + host.name )
c = Arver::SSHCommandWrapper.create( host.pre_close, [] , host, true )
unless c.execute
Arver::Log.error( "Aborting: pre_close on #{host.name} failed:\n"+c.output )
throw( :abort_action )
end
end
|
#pre_partition(partition) ⇒ Object
31
32
33
34
35
36
37
38
39
|
# File 'lib/arver/close_action.rb', line 31
def pre_partition( partition )
return if partition.pre_close.nil?
Arver::Log.info( "Running script: " + partition.pre_close + " on " + partition.parent.name )
c = Arver::SSHCommandWrapper.create( partition.pre_close, [] , partition.parent, true )
unless c.execute
Arver::Log.error( "Aborting: pre_close on #{partition.name} failed:\n"+c.output )
throw( :abort_action )
end
end
|
#verify?(partition) ⇒ Boolean
4
5
6
7
8
9
10
|
# File 'lib/arver/close_action.rb', line 4
def verify?( partition )
unless( Arver::LuksWrapper.open?(partition).execute )
Arver::Log.error( partition.name+" not open. skipping." )
return false
end
true
end
|