Fix "vargant package" for LXC 2.1+ config format
New config format would be under `lxc.rootfs.path` and be prefixed by `dir:`.
This commit is contained in:
parent
a1aa60ded5
commit
2a5510b34c
1 changed files with 6 additions and 6 deletions
|
@ -50,20 +50,20 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def rootfs_path
|
def rootfs_path
|
||||||
config_entry = config_string.match(/^lxc\.rootfs\s+=\s+(.+)$/)[1]
|
pathtype, path = config_string.match(/^lxc\.rootfs(?:\.path)?\s+=\s+(.+:)?(.+)$/)[1..2]
|
||||||
case config_entry
|
case pathtype
|
||||||
when /^overlayfs:/
|
when 'overlayfs:'
|
||||||
# Split on colon (:), ignoring any colon escaped by an escape character ( \ )
|
# Split on colon (:), ignoring any colon escaped by an escape character ( \ )
|
||||||
# Pays attention to when the escape character is itself escaped.
|
# 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
|
if overlay_path
|
||||||
Pathname.new(overlay_path)
|
Pathname.new(overlay_path)
|
||||||
else
|
else
|
||||||
# Malformed: fall back to prior behaviour
|
# Malformed: fall back to prior behaviour
|
||||||
Pathname.new(config_entry)
|
Pathname.new(path)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Pathname.new(config_entry)
|
Pathname.new(path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue