cfa_grub2 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfa/grub2/default.rb +20 -14
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af13a6ea41486f646e9debfb46c3a809e4a97391
|
4
|
+
data.tar.gz: afb3f9b421872d38c9ec9604ac687d1490c4edcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0c0df8ced8a6302c4bfef86296e839f3c81275d52470eda36faa9be5739dd37ca7fe99c46616d93cdf8f0b7b04cdf8cc0267984e99a4beefbf9236081fb911a
|
7
|
+
data.tar.gz: 733243ede8cf8c5f866487d6999249c31d903ec7ab6e41de0232586c9d199ba48854f3d91f22962ad15ed973f961b7059f2062e00aa5a71d5e88204d262e06aa
|
data/lib/cfa/grub2/default.rb
CHANGED
@@ -70,15 +70,14 @@ module CFA
|
|
70
70
|
|
71
71
|
def xen_hypervisor_params
|
72
72
|
@xen_hypervisor_params ||= KernelParams.new(
|
73
|
-
data["
|
74
|
-
"
|
73
|
+
data["GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT"],
|
74
|
+
"GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT"
|
75
75
|
)
|
76
76
|
end
|
77
77
|
|
78
78
|
def xen_kernel_params
|
79
79
|
@xen_kernel_params ||= KernelParams.new(
|
80
|
-
data["
|
81
|
-
"GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT"
|
80
|
+
data["GRUB_CMDLINE_XEN_DEFAULT"], "GRUB_CMDLINE_XEN_DEFAULT"
|
82
81
|
)
|
83
82
|
end
|
84
83
|
|
@@ -186,6 +185,7 @@ module CFA
|
|
186
185
|
def add_parameter(key, value, placer = AppendPlacer.new)
|
187
186
|
element = placer.new_element(@tree)
|
188
187
|
|
188
|
+
element[:operation] = :add
|
189
189
|
element[:key] = key
|
190
190
|
element[:value] = value
|
191
191
|
end
|
@@ -193,31 +193,29 @@ module CFA
|
|
193
193
|
# Removes parameter from kernel command line.
|
194
194
|
# @param matcher [Matcher] to find entry to remove
|
195
195
|
def remove_parameter(matcher)
|
196
|
-
@tree.data.
|
196
|
+
@tree.data.select(&matcher).each { |e| e[:operation] = :remove }
|
197
197
|
end
|
198
198
|
|
199
199
|
# Represents parsed kernel parameters tree. Parses in initialization
|
200
200
|
# and backserilized by `to_string`.
|
201
201
|
# TODO: replace it via augeas parser when someone write lense
|
202
202
|
class ParamTree
|
203
|
-
attr_reader :data
|
204
|
-
|
205
203
|
def initialize(line)
|
206
|
-
line
|
207
|
-
|
208
|
-
|
209
|
-
.map { |e| e.split("=", 2) }
|
204
|
+
pairs = (line || "").split(/\s/)
|
205
|
+
.reject(&:empty?)
|
206
|
+
.map { |e| e.split("=", 2) }
|
210
207
|
|
211
208
|
@data = pairs.map do |k, v|
|
212
209
|
{
|
213
|
-
key:
|
214
|
-
value:
|
210
|
+
key: k,
|
211
|
+
value: v || true, # kernel param without value have true
|
212
|
+
operation: :keep
|
215
213
|
}
|
216
214
|
end
|
217
215
|
end
|
218
216
|
|
219
217
|
def to_string
|
220
|
-
snippets =
|
218
|
+
snippets = data.map do |e|
|
221
219
|
if e[:value] == true
|
222
220
|
e[:key]
|
223
221
|
else
|
@@ -227,6 +225,14 @@ module CFA
|
|
227
225
|
|
228
226
|
snippets.join(" ")
|
229
227
|
end
|
228
|
+
|
229
|
+
def data
|
230
|
+
@data.select { |e| e[:operation] != :remove }.freeze
|
231
|
+
end
|
232
|
+
|
233
|
+
def all_data
|
234
|
+
@data
|
235
|
+
end
|
230
236
|
end
|
231
237
|
end
|
232
238
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfa_grub2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Reidinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfa
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.5'
|
27
27
|
description: Models allowing easy read and modification of GRUB2 configuration files.
|
28
28
|
It is a plugin for cfa framework.
|
29
29
|
email:
|
@@ -56,8 +56,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
version: 1.3.6
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.2.2
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: Models for GRUB2 configuration files.
|
63
63
|
test_files: []
|
64
|
+
has_rdoc:
|