Class: Kscript::KkLvmManageUtils
- Inherits:
-
Base
- Object
- Base
- Kscript::KkLvmManageUtils
show all
- Defined in:
- lib/kscript/plugins/kk_lvm_manage_utils.rb
Constant Summary
collapse
- DEFAULT_CONFIG =
{
device: '/dev/sdb',
volume_group: 'vg_data',
logical_volume: 'lv_data',
mount_point: '/data'
}.freeze
Instance Attribute Summary collapse
Attributes inherited from Base
#logger
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#human_output?, inherited, #with_error_handling
Constructor Details
Initialize the LVM mounter with configuration
23
24
25
26
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 23
def initialize(*args, **opts)
super
@config = DEFAULT_CONFIG.merge(opts)
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
19
20
21
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 19
def config
@config
end
|
Class Method Details
.arguments ⇒ Object
45
46
47
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 45
def self.arguments
'<device> <mount_point>'
end
|
.author ⇒ Object
57
58
59
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 57
def self.author
'kk'
end
|
.description ⇒ Object
61
62
63
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 61
def self.description
'Mount and manage Linux LVM volumes.'
end
|
.group ⇒ Object
53
54
55
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 53
def self.group
'system'
end
|
.usage ⇒ Object
49
50
51
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 49
def self.usage
"kscript lvm_manage /dev/sda2 /mnt/data\nkscript lvm_manage /dev/vg0/lv_home /mnt/home"
end
|
Instance Method Details
#run ⇒ Object
28
29
30
31
32
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 28
def run
with_error_handling do
setup
end
end
|
#setup ⇒ Object
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/kscript/plugins/kk_lvm_manage_utils.rb', line 34
def setup
validate_device
ensure_lvm_tools_installed
setup_physical_volume
setup_volume_group
setup_logical_volume
format_and_mount_volume
update_fstab
display_mount_status
end
|