Commit ec4daf3
committed
Fix REXML 3.4.2+ compatibility
REXML 3.4.2+ deprecated accepting array as an element in `XPath.match`
[[1]]. This led to test errors such as:
~~~
3) VagrantPlugins::ProviderLibvirt::Action::ResolveDiskSettings#call when vm box is in use when box metadata is not available when multiple volumes in domain config should populate domain volumes with devices
Failure/Error:
expect(env[:domain_volumes]).to match(
[
hash_including(
device: 'vda',
absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img'
),
hash_including(
device: 'vdb',
absolute_path: '/var/lib/libvirt/images/vagrant-test_default_1.img'
),
expected [{absolute_path: "/var/lib/libvirt/images/vagrant-test_default.img", bus: "virtio", cache: "default", device: "vda", name: "vagrant-test_default.img"}] to match [#<RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher:0x00007fff921b3db8 @expected={device: "vda", absolute_path: "/var/lib/libvirt/images/vagrant-test_default.img"}>, #<RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher:0x00007fff921b3d40 @expected={device: "vdb", absolute_path: "/var/lib/libvirt/images/vagrant-test_default_1.img"}>, #<RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher:0x00007fff921b3cc8 @expected={device: "vdc", absolute_path: "/var/lib/libvirt/images/vagrant-test_default_2.img"}>]
Diff:
@@ -1,4 +1,6 @@
-[hash_including(device: "vda", absolute_path: "/var/lib/libvirt/images/vagrant-test_default.img"),
- hash_including(device: "vdb", absolute_path: "/var/lib/libvirt/images/vagrant-test_default_1.img"),
- hash_including(device: "vdc", absolute_path: "/var/lib/libvirt/images/vagrant-test_default_2.img")]
+[{absolute_path: "/var/lib/libvirt/images/vagrant-test_default.img",
+ bus: "virtio",
+ cache: "default",
+ device: "vda",
+ name: "vagrant-test_default.img"}]
# ./spec/unit/action/resolve_disk_settings_spec.rb:200:in 'block (6 levels) in <top (required)>'
# ./spec/support/unit_context.rb:51:in 'block (3 levels) in <top (required)>'
# ./spec/support/unit_context.rb:43:in 'block (2 levels) in <top (required)>'
# ./spec/support/unit_context.rb:51:in 'block (3 levels) in <top (required)>'
# ./spec/support/unit_context.rb:43:in 'block (2 levels) in <top (required)>'
~~~
This changes the logic in a way, that XPath is matching against whole
XML document, instead of array of XML elements.
[1]: ruby/rexml#2521 parent a94ce0d commit ec4daf3
File tree
2 files changed
+11
-8
lines changed- lib/vagrant-libvirt/action
2 files changed
+11
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
133 | | - | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
139 | | - | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
0 commit comments