Skip to content

Commit

Permalink
Handle REXML requires for Ubuntu focal
Browse files Browse the repository at this point in the history
The distribution provided vagrant package on Ubuntu 20.04 is version
2.2.6 running on ruby 2.7.2. It appears that the rexml layout is
slightly different and imports different paths than the current code
expects. Add this combination to the unit tests and switch the requires
to load the specific library requirements instead of relying on rexml
loading everything underneath.

Additionally it appears the hook behaviour change appeared earlier that
the understood vagrant release of 2.2.11, and 2.2.6 also requires the
newer hook behaviour.
  • Loading branch information
electrofelix committed Sep 8, 2022
1 parent 602b4e9 commit c627059
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/unit-tests.yml
Expand Up @@ -41,6 +41,10 @@ jobs:
- ruby: 2.6.6
vagrant: v2.2.14
allow_fail: false
- ruby: 2.7.2
vagrant: v2.2.6
allow_fail: false
# above block is to ensure compatible with Ubuntu 20.04 vagrant package
- ruby: 3.0.0
vagrant:
allow_fail: false
Expand Down
7 changes: 2 additions & 5 deletions lib/vagrant-libvirt/action/destroy_domain.rb
Expand Up @@ -2,11 +2,8 @@

require 'log4r'

begin
require 'rexml'
rescue LoadError
require 'rexml/rexml'
end
require 'rexml/document'
require 'rexml/xpath'

require 'vagrant-libvirt/util/domain_flags'

Expand Down
7 changes: 2 additions & 5 deletions lib/vagrant-libvirt/action/resolve_disk_settings.rb
Expand Up @@ -2,11 +2,8 @@

require 'log4r'

begin
require 'rexml'
rescue LoadError
require 'rexml/rexml'
end
require 'rexml/document'
require 'rexml/xpath'

require 'vagrant-libvirt/util/resolvers'

Expand Down
2 changes: 2 additions & 0 deletions lib/vagrant-libvirt/action/start_domain.rb
Expand Up @@ -3,6 +3,8 @@
require 'log4r'

require 'rexml/document'
require 'rexml/formatters/pretty'
require 'rexml/xpath'

require 'vagrant-libvirt/util/xml'

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-libvirt/util/compat.rb
Expand Up @@ -11,7 +11,7 @@ module Util
module Compat
def self.action_hook_args(name, action)
# handle different number of arguments for action_hook depending on vagrant version
if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('2.2.11')
if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('2.2.6')
return name, action
end

Expand Down

0 comments on commit c627059

Please sign in to comment.