chef-ruby-lvm 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/examples/additional_arguments.rb +13 -0
- data/lib/lvm.rb +2 -0
- data/lib/lvm/version.rb +1 -1
- data/lib/lvm/wrapper.rb +5 -2
- data/lib/lvm/wrapper/lvs.rb +1 -1
- data/lib/lvm/wrapper/lvsseg.rb +1 -1
- data/lib/lvm/wrapper/pvs.rb +1 -1
- data/lib/lvm/wrapper/pvsseg.rb +1 -1
- data/lib/lvm/wrapper/vgs.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1c6e301ce4adb07645a893d2252dbf09afa4a48e0c499009fd05f6b2986af4a6
|
4
|
+
data.tar.gz: d583993d1b468e641e309cdb3588df42aa2180b7201d1d92f9f061baa28e9169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5143a086558cbc283dbb1a191bfd06550c9b4993e2430918537d6b4651101563526f9d0bbb89949a19f547df49d229e77aca8c47540b5fe764404dce247c5252
|
7
|
+
data.tar.gz: bc4dcb8a345d1de6dd4b86eac506118d418663ba75ebb1769199130e70fce32f821248b3d211ceeffbddabc78f51982fabff6d8e3e2e50a75ff6fc51cdd17bee
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Demonstration of passing additional arguments to the LVM object
|
4
|
+
|
5
|
+
$: << File.dirname(__FILE__) + "/../lib"
|
6
|
+
|
7
|
+
require "lvm"
|
8
|
+
|
9
|
+
# List out volume groups with the --ignoreskippedcluster argument appended to the base argument list
|
10
|
+
lvm = LVM::LVM.new(:command => "/usr/bin/sudo /sbin/lvm", :additional_arguments => "--ignoreskippedcluster")
|
11
|
+
|
12
|
+
volume_groups = lvm.volume_groups
|
13
|
+
puts volume_groups.map { |vg| vg.name }
|
data/lib/lvm.rb
CHANGED
@@ -11,11 +11,13 @@ module LVM
|
|
11
11
|
attr_reader :logical_volumes
|
12
12
|
attr_reader :volume_groups
|
13
13
|
attr_reader :physical_volumes
|
14
|
+
attr_reader :additional_arguments
|
14
15
|
|
15
16
|
VALID_OPTIONS = [
|
16
17
|
:command,
|
17
18
|
:version,
|
18
19
|
:debug,
|
20
|
+
:additional_arguments,
|
19
21
|
]
|
20
22
|
|
21
23
|
DEFAULT_COMMAND = "/sbin/lvm"
|
data/lib/lvm/version.rb
CHANGED
data/lib/lvm/wrapper.rb
CHANGED
@@ -38,13 +38,16 @@ module LVM
|
|
38
38
|
end
|
39
39
|
module_function :process_line
|
40
40
|
|
41
|
-
def build_command(expected_attributes, base)
|
41
|
+
def build_command(expected_attributes, base, additional_arguments = [])
|
42
42
|
opts = []
|
43
43
|
expected_attributes.each do |a|
|
44
44
|
opts << a[:column]
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
additional_arguments = [] if additional_arguments.nil?
|
48
|
+
additional_arguments = [additional_arguments] if additional_arguments.is_a?(String)
|
49
|
+
|
50
|
+
return base % opts.join(",") + "#{additional_arguments.empty? ? '' : ' '}#{additional_arguments.join(' ')}"
|
48
51
|
end
|
49
52
|
module_function :build_command
|
50
53
|
end # module Reporting
|
data/lib/lvm/wrapper/lvs.rb
CHANGED
@@ -11,7 +11,7 @@ module LVM
|
|
11
11
|
|
12
12
|
def initialize(options)
|
13
13
|
@attributes = Attributes.load(options[:version], ATTRIBUTES_FILE)
|
14
|
-
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND)}"
|
14
|
+
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND, options[:additional_arguments])}"
|
15
15
|
end
|
16
16
|
|
17
17
|
BASE_COMMAND = "lvs #{Reporting::BASE_ARGUMENTS}"
|
data/lib/lvm/wrapper/lvsseg.rb
CHANGED
@@ -12,7 +12,7 @@ module LVM
|
|
12
12
|
|
13
13
|
def initialize(options)
|
14
14
|
@attributes = Attributes.load(options[:version], ATTRIBUTES_FILE)
|
15
|
-
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND)}"
|
15
|
+
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND, options[:additional_arguments])}"
|
16
16
|
end
|
17
17
|
|
18
18
|
BASE_COMMAND = "lvs #{Reporting::BASE_ARGUMENTS}"
|
data/lib/lvm/wrapper/pvs.rb
CHANGED
@@ -11,7 +11,7 @@ module LVM
|
|
11
11
|
|
12
12
|
def initialize(options)
|
13
13
|
@attributes = Attributes.load(options[:version], ATTRIBUTES_FILE)
|
14
|
-
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND)}"
|
14
|
+
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND, options[:additional_arguments])}"
|
15
15
|
end
|
16
16
|
|
17
17
|
BASE_COMMAND = "pvs #{Reporting::BASE_ARGUMENTS}"
|
data/lib/lvm/wrapper/pvsseg.rb
CHANGED
@@ -12,7 +12,7 @@ module LVM
|
|
12
12
|
|
13
13
|
def initialize(options)
|
14
14
|
@attributes = Attributes.load(options[:version], ATTRIBUTES_FILE)
|
15
|
-
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND)}"
|
15
|
+
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND, options[:additional_arguments])}"
|
16
16
|
end
|
17
17
|
|
18
18
|
BASE_COMMAND = "pvs #{Reporting::BASE_ARGUMENTS}"
|
data/lib/lvm/wrapper/vgs.rb
CHANGED
@@ -11,7 +11,7 @@ module LVM
|
|
11
11
|
|
12
12
|
def initialize(options)
|
13
13
|
@attributes = Attributes.load(options[:version], ATTRIBUTES_FILE)
|
14
|
-
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND)}"
|
14
|
+
@command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND, options[:additional_arguments])}"
|
15
15
|
end
|
16
16
|
|
17
17
|
BASE_COMMAND = "vgs #{Reporting::BASE_ARGUMENTS}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-ruby-lvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Smith
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: open4
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- README.md
|
62
62
|
- Rakefile
|
63
63
|
- chef-ruby-lvm.gemspec
|
64
|
+
- examples/additional_arguments.rb
|
64
65
|
- examples/create_snapshot.rb
|
65
66
|
- examples/error_handling.rb
|
66
67
|
- examples/show_lvm_config.rb
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
version: '0'
|
106
107
|
requirements: []
|
107
108
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.7.5
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: A wrapper for the LVM2 administration utility, lvm.
|