Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
Fix "vargant package" for LXC 2.1+ config format
Browse files Browse the repository at this point in the history
New config format would be under `lxc.rootfs.path` and be prefixed by
`dir:`.
  • Loading branch information
Virgil Dupras committed Jul 24, 2018
1 parent a1aa60d commit 2a5510b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/vagrant-lxc/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ def config_path
end

def rootfs_path
config_entry = config_string.match(/^lxc\.rootfs\s+=\s+(.+)$/)[1]
case config_entry
when /^overlayfs:/
pathtype, path = config_string.match(/^lxc\.rootfs(?:\.path)?\s+=\s+(.+:)?(.+)$/)[1..2]
case pathtype
when 'overlayfs:'
# Split on colon (:), ignoring any colon escaped by an escape character ( \ )
# Pays attention to when the escape character is itself escaped.
fs_type, master_path, overlay_path = config_entry.split(/(?<!\\)(?:\\\\)*:/)
_, overlay_path = config_entry.split(/(?<!\\)(?:\\\\)*:/)
if overlay_path
Pathname.new(overlay_path)
else
# Malformed: fall back to prior behaviour
Pathname.new(config_entry)
Pathname.new(path)
end
else
Pathname.new(config_entry)
Pathname.new(path)
end
end

Expand Down

0 comments on commit 2a5510b

Please sign in to comment.