ec2-consistent-snapshot-rb 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -1,6 +1,12 @@
1
1
  = ec2-consistent-snapshot-rb
2
2
 
3
- Description goes here.
3
+ This is a ruby port of the very useful ec2-consistent-snapshot script by Eric Hammond
4
+ (http://alestic.com/2009/09/ec2-consistent-snapshot). It does not include all the features
5
+ yet, but does include:
6
+
7
+ * Freezing an XFS filesystem while snapshots are taken
8
+ * Flushing and locking MySQL tables during snapshotting
9
+ * Dumping master and slave information so that the snapshot can be used to init a new slave
4
10
 
5
11
  == Contributing to ec2-consistent-snapshot-rb
6
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -31,9 +31,9 @@ OptionParser.new do |o|
31
31
  o.on("--description STRING", "The description for the snapshot") {|v| $opts[:description] = v }
32
32
  o.on("--xfs-filesystem MOUNTPOINT", "Filesystem to be frozen during snapshot") {|v| $opts[:xfs_filesystem] = v }
33
33
  o.on("--mysql", "Indicates that the volume has mysql") {|v| $opts[:mysql] = v }
34
- o.on("--mysql-username USERNAME", "MySQL user to connect as") {|v| $opts[:mysql_username] = v }
35
- o.on("--mysql-password PASSWORD", "MySQL password") {|v| $opts[:mysql_password] = v }
36
- o.on("--mysql-host HOST", "MySQL host") {|v| $opts[:mysql_host] = v }
34
+ o.on("--mysql-username USERNAME", "MySQL user (default: root)") {|v| $opts[:mysql_username] = v }
35
+ o.on("--mysql-password PASSWORD", "MySQL password (default: none)") {|v| $opts[:mysql_password] = v }
36
+ o.on("--mysql-host HOST", "MySQL host (default: 127.0.0.1)") {|v| $opts[:mysql_host] = v }
37
37
  o.on("--mysql-master-status-file FILENAME", "File to store in snapshot with master status") {|v| $opts[:mysql_master_status_file] = v }
38
38
  o.on("--mysql-slave-status-file FILENAME", "File to store in snapshot with slave status") {|v| $opts[:mysql_slave_status_file] = v }
39
39
  end.parse!
@@ -81,15 +81,21 @@ def mysql_locked(&block)
81
81
  mysql.query("SET SQL_LOG_BIN=1")
82
82
  end
83
83
 
84
- yield
85
-
86
- mysql.real_query("UNLOCK TABLES") if mysql
84
+ begin
85
+ yield
86
+ ensure
87
+ mysql.real_query("UNLOCK TABLES") if mysql
88
+ end
87
89
  end
88
90
 
89
91
  def xfs_frozen(&block)
90
92
  system('xfs_freeze', '-f', $opts[:xfs_filesystem]) if $opts[:xfs_filesystem]
91
- yield
92
- system('xfs_freeze', '-u', $opts[:xfs_filesystem]) if $opts[:xfs_filesystem]
93
+
94
+ begin
95
+ yield
96
+ ensure
97
+ system('xfs_freeze', '-u', $opts[:xfs_filesystem]) if $opts[:xfs_filesystem]
98
+ end
93
99
  end
94
100
 
95
101
  begin
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ec2-consistent-snapshot-rb}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Zach Wily"]
12
- s.date = %q{2010-12-29}
12
+ s.date = %q{2010-12-30}
13
13
  s.default_executable = %q{ec2-consistent-snapshot-rb}
14
14
  s.description = %q{Ported from ec2-consistent-snapshot (http://alestic.com/2009/09/ec2-consistent-snapshot)}
15
15
  s.email = %q{zach@zwily.com}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2-consistent-snapshot-rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Zach Wily
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-29 00:00:00 -07:00
18
+ date: 2010-12-30 00:00:00 -07:00
19
19
  default_executable: ec2-consistent-snapshot-rb
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency