Class: Elasticsnap::FreezeFs
- Inherits:
-
Object
- Object
- Elasticsnap::FreezeFs
- Defined in:
- lib/elasticsnap/freeze_fs.rb
Instance Attribute Summary collapse
-
#mount ⇒ Object
Returns the value of attribute mount.
-
#security_group ⇒ Object
Returns the value of attribute security_group.
-
#ssh_user ⇒ Object
Returns the value of attribute ssh_user.
Instance Method Summary collapse
- #freeze(&block) ⇒ Object
- #freeze_fs ⇒ Object
-
#initialize(mount: nil, security_group: nil, ssh_user: nil) ⇒ FreezeFs
constructor
A new instance of FreezeFs.
- #sync ⇒ Object
- #unfreeze_fs ⇒ Object
Constructor Details
#initialize(mount: nil, security_group: nil, ssh_user: nil) ⇒ FreezeFs
Returns a new instance of FreezeFs.
9 10 11 12 13 14 15 16 |
# File 'lib/elasticsnap/freeze_fs.rb', line 9 def initialize(mount: nil, security_group: nil, ssh_user: nil) raise ArgumentError, 'mount required' if mount.nil? raise ArgumentError, 'security_group required' if security_group.nil? @mount = mount @security_group = security_group @ssh_user = ssh_user end |
Instance Attribute Details
#mount ⇒ Object
Returns the value of attribute mount.
5 6 7 |
# File 'lib/elasticsnap/freeze_fs.rb', line 5 def mount @mount end |
#security_group ⇒ Object
Returns the value of attribute security_group.
6 7 8 |
# File 'lib/elasticsnap/freeze_fs.rb', line 6 def security_group @security_group end |
#ssh_user ⇒ Object
Returns the value of attribute ssh_user.
7 8 9 |
# File 'lib/elasticsnap/freeze_fs.rb', line 7 def ssh_user @ssh_user end |
Instance Method Details
#freeze(&block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elasticsnap/freeze_fs.rb', line 18 def freeze(&block) begin sync freeze_fs block.call unless block.nil? ensure unfreeze_fs end end |
#freeze_fs ⇒ Object
33 34 35 |
# File 'lib/elasticsnap/freeze_fs.rb', line 33 def freeze_fs run_command 'sudo fsfreeze', '-f', mount end |
#sync ⇒ Object
29 30 31 |
# File 'lib/elasticsnap/freeze_fs.rb', line 29 def sync run_command('sudo sync') end |
#unfreeze_fs ⇒ Object
37 38 39 |
# File 'lib/elasticsnap/freeze_fs.rb', line 37 def unfreeze_fs run_command 'sudo fsfreeze', '-u', mount end |