chef-ruby-lvm 0.3.0 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e7275c5fa9d67b4e1d363b5b5d881e8360bf3f5d
4
- data.tar.gz: 2ccee9355be13c3718be47859b79bc2ce438e04b
2
+ SHA256:
3
+ metadata.gz: 1c6e301ce4adb07645a893d2252dbf09afa4a48e0c499009fd05f6b2986af4a6
4
+ data.tar.gz: d583993d1b468e641e309cdb3588df42aa2180b7201d1d92f9f061baa28e9169
5
5
  SHA512:
6
- metadata.gz: 207a4ffda7f53258a316f573c82f51ffb9c910d0db68505e6e3e68321fa5442b5cf61d39d5c4f81b610818cbfa3a1dfcb3ccd6036e4813d48711822fb7dcbee0
7
- data.tar.gz: 36a88227100fdd3f78c5d723f6f36163baaf136e66fc168f20057cf26e1546347e6d9decfe7639300491ce80f1d574a10f7bb4fcebfee4d717583c12d4547794
6
+ metadata.gz: 5143a086558cbc283dbb1a191bfd06550c9b4993e2430918537d6b4651101563526f9d0bbb89949a19f547df49d229e77aca8c47540b5fe764404dce247c5252
7
+ data.tar.gz: bc4dcb8a345d1de6dd4b86eac506118d418663ba75ebb1769199130e70fce32f821248b3d211ceeffbddabc78f51982fabff6d8e3e2e50a75ff6fc51cdd17bee
@@ -1,3 +1,7 @@
1
+ # 0.4.0 (2018-07-23)
2
+
3
+ - Added additional_arguments option that allows passing options to commands
4
+
1
5
  # 0.3.0 (2016-06-21)
2
6
 
3
7
  - Depend on di-ruby-lvm-attrib ~0.2 to bring in the last few years of releases
@@ -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"
@@ -1,3 +1,3 @@
1
1
  module LVM
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -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
- return base % opts.join(",")
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
@@ -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}"
@@ -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}"
@@ -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}"
@@ -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}"
@@ -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.3.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: 2017-06-21 00:00:00.000000000 Z
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.6.12
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.