Class: VGH::APPS::Checkpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/vgh/apps/checkpoint.rb

Overview

Description:

See Checkpoint Section in the README file.

Usage:

checkpoint = APPS::Checkpoint.new
checkpoint.run

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCheckpoint

Initialize external classes



22
23
24
25
# File 'lib/vgh/apps/checkpoint.rb', line 22

def initialize
  @volumes ||= EC2::Volume.new
  @snapshot = EC2::Snapshot.new
end

Instance Attribute Details

#snapshotObject (readonly)

Returns Snapshot Class.

Returns:

  • (Object)

    Snapshot Class



19
20
21
# File 'lib/vgh/apps/checkpoint.rb', line 19

def snapshot
  @snapshot
end

#volumesObject (readonly)

Returns Volumes Class.

Returns:

  • (Object)

    Volumes Class



16
17
18
# File 'lib/vgh/apps/checkpoint.rb', line 16

def volumes
  @volumes
end

Instance Method Details

#runObject

Runs the checkpoint app logic



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/vgh/apps/checkpoint.rb', line 28

def run

  System.lock

  volumes.list_tagged('CHECKPOINT').map {|vid|
    snapshot.snap_and_tag(
      vid,
      "CHECKPOINT for #{vid}(#{volumes.name_tag(vid)})",
      {
        'Name'   => fqdn,
        'CHECKPOINT' => "#{vid}"
      }
    )
    snapshot.purge_checkpoints
  }

  System.unlock

end