vgh 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.2.1
2
+ - Fix SQL and LVM checks
3
+
1
4
  === 0.2.0
2
5
  - Add Checkpoint app
3
6
  - Merged all configuration files to a single one
@@ -54,7 +54,7 @@ class Snapshot
54
54
  # Tags a Snapshot
55
55
  def tag_snapshot
56
56
  snap = snapshot
57
- message.info "Tagging snapshot \"#{snap.id}\""
57
+ message.info "Tagging snapshot \"#{snap.id}\"..."
58
58
  tags.map {|key, value|
59
59
  ec2.tags.create(snap, key, {:value => value})
60
60
  }
@@ -19,11 +19,6 @@ module System
19
19
  #
20
20
  class LVM
21
21
 
22
- # Loads variables and checks if LVM Tools are installed
23
- def initialize
24
- installed?
25
- end
26
-
27
22
  # @return [String] The dmsetup system command
28
23
  def dm_cmd
29
24
  @dmcmd ||= '/sbin/dmsetup'
@@ -41,46 +36,27 @@ class LVM
41
36
 
42
37
  # @return [String] A list of logical volumes present
43
38
  def lvs
39
+ @lvs = []
44
40
  if ( installed? and System.is_root? )
45
- @lvs ||= `#{dm_cmd} ls | /bin/grep -E -v 'swap|root'`
41
+ lv_list = `#{dm_cmd} ls | /bin/grep -E -v 'swap|root'`
42
+ @lvs.push(lv_list.split[0]) unless lv_list == "No devices found\n"
46
43
  else
47
44
  message.warn "Listing logical volume needs root privileges!"
48
- return nil
49
- end
50
- end
51
-
52
- # Test if logical volumes are present
53
- # @return [Boolean]
54
- def lvs_are_present?
55
- if lvs != "No devices found\n" then
56
- return true
57
- else
58
- message.info "No logical volumes found."
59
- return false
60
45
  end
61
- end
62
-
63
- # Suspend all logical volume
64
- def suspend
65
- suspend_lvs if lvs_are_present?
46
+ return @lvs
66
47
  end
67
48
 
68
49
  # The actual suspend action
69
- def suspend_lvs
70
- for lv_name in lvs.split[0]
50
+ def suspend
51
+ for lv_name in lvs
71
52
  message.info "Suspending Logical Volume '#{lv_name}'..."
72
53
  `#{dm_cmd} suspend #{lv_name}`
73
54
  end
74
55
  end
75
56
 
76
- # Resume all logical volumes
77
- def resume
78
- resume_lvs if lvs_are_present?
79
- end
80
-
81
57
  # The actual resume action
82
- def resume_lvs
83
- for lv_name in lvs.split[0]
58
+ def resume
59
+ for lv_name in lvs
84
60
  message.info "Resuming Logical Volume '#{lv_name}'..."
85
61
  `#{dm_cmd} resume #{lv_name}`
86
62
  end
@@ -16,8 +16,8 @@ class MySQL
16
16
 
17
17
  # Load defaults
18
18
  def initialize
19
- @mysqladmin = '/usr/bin/mysqladmin'
20
- @mysql = '/usr/bin/mysql'
19
+ @mysqladmin_cmd = '/usr/bin/mysqladmin'
20
+ @mysql_cmd = '/usr/bin/mysql'
21
21
  end
22
22
 
23
23
  # Get MySQL user
@@ -32,17 +32,27 @@ class MySQL
32
32
  @mysql_password ||= config[:mysql_password]
33
33
  end
34
34
 
35
+ # Check if server is running and we have the right credentials
36
+ # @return [Boolean]
37
+ def commands_present?
38
+ commands_present = false
39
+ if File.exists?(@mysqladmin_cmd) and File.exists?(@mysqladmin_cmd)
40
+ commands_present = true
41
+ end
42
+ return commands_present
43
+ end
35
44
 
36
45
  # Check if server is running and we have the right credentials
37
46
  # @return [Boolean]
38
47
  def mysql_exists?
39
48
  mysql_exists = false
40
- if File.exists?(@mysqladmin)
41
- mysql_exists = system "#{@mysqladmin} -s ping"
42
- if ! mysql_user and ! mysql_password
43
- message.warning 'WARNING: MySQL exists but no credentials were found!'
44
- mysql_exists = false
45
- end
49
+ server_present = system "#{@mysqladmin_cmd} -s ping" if commands_present?
50
+ if server_present and mysql_user.nil? and mysql_password.nil?
51
+ message.warn 'WARNING: MySQL exists but no credentials were found!'
52
+ elsif ! server_present and ! mysql_user.nil? and ! mysql_password.nil?
53
+ message.warn 'WARNING: MySQL credentials exist but no local server was found!'
54
+ elsif server_present and ! mysql_user.nil? and ! mysql_password.nil?
55
+ mysql_exists = true
46
56
  end
47
57
  return mysql_exists
48
58
  end
@@ -69,3 +79,4 @@ end # module VGH
69
79
 
70
80
  require 'vgh/output'
71
81
  require 'vgh/configuration'
82
+
data/lib/vgh/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module VGH
2
2
  # Version number
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
 
5
5
  # Returns the version number
6
6
  def version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vgh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  segments:
187
187
  - 0
188
- hash: -87386979
188
+ hash: 1008001245
189
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  none: false
191
191
  requirements:
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  segments:
196
196
  - 0
197
- hash: -87386979
197
+ hash: 1008001245
198
198
  requirements: []
199
199
  rubyforge_project:
200
200
  rubygems_version: 1.8.23