Module: VGH::System
- Defined in:
- lib/vgh/system.rb,
lib/vgh/system/lvm.rb,
lib/vgh/system/mysql.rb
Overview
This is a parent class for different system actions performed by the scripts included in this gem. For more information see the classes defined under this namespace.
Usage
fqdn = System.fqdn
Defined Under Namespace
Class Method Summary collapse
-
.fqdn ⇒ String
Returns the current system’s FQDN.
-
.is_root? ⇒ Boolean
Check if the script is run as root.
-
.lock ⇒ String
Returns the current system’s FQDN.
-
.lvm ⇒ Object
Initializes the LVM class.
-
.mysql ⇒ Object
Initializes the MySQL class.
-
.remotely? ⇒ Boolean
Checks if this script is run remotely.
-
.unlock ⇒ String
Returns the current system’s FQDN.
Class Method Details
.fqdn ⇒ String
Returns the current system’s FQDN
38 39 40 |
# File 'lib/vgh/system.rb', line 38 def self.fqdn $fqdn ||= `hostname -f`.strip end |
.is_root? ⇒ Boolean
Check if the script is run as root
28 29 30 31 32 33 34 |
# File 'lib/vgh/system.rb', line 28 def self.is_root? if Process.uid == 0 return true else return false end end |
.lock ⇒ String
Returns the current system’s FQDN
44 45 46 47 48 49 |
# File 'lib/vgh/system.rb', line 44 def self.lock unless remotely? mysql.flush lvm.suspend end end |
.lvm ⇒ Object
Initializes the LVM class
77 78 79 |
# File 'lib/vgh/system.rb', line 77 def self.lvm lvm ||= System::LVM.new end |
.mysql ⇒ Object
Initializes the MySQL class
72 73 74 |
# File 'lib/vgh/system.rb', line 72 def self.mysql mysql ||= System::MySQL.new end |
.remotely? ⇒ Boolean
Checks if this script is run remotely.
62 63 64 65 66 67 68 69 |
# File 'lib/vgh/system.rb', line 62 def self.remotely? cfg = config if cfg[:instance] or cfg[:fqdn] return true else return false end end |
.unlock ⇒ String
Returns the current system’s FQDN
53 54 55 56 57 58 |
# File 'lib/vgh/system.rb', line 53 def self.unlock unless remotely? mysql.unlock lvm.resume end end |