vagrant-commit 0.6 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vagrant-commit/command.rb +66 -0
- data/lib/vagrant-commit/plugin.rb +6 -1
- data/lib/vagrant-commit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29d259393ffcb220f7b9585d40ab8314279b9758fe6d4b1ab23299ac7c64fae0
|
4
|
+
data.tar.gz: 9fd10897890403f3fed69e0557c62deccdb1b63cd4e083cbf9fbdb22428b87ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c94189424a37a506c6434156378442230fc25b1d5ec3b9639c53c12d0c1d1cee449e46c7c0e030edfc06bc62eb3d42ba8174f7487fa1db7a18a845a1ed1bd88
|
7
|
+
data.tar.gz: ca8714dab547af8ac59c6dc8f70a224aaf1c2f79fb366f4d5b94129ef62b2dc2f4b6f951f9ccca0d1c117bef9d471c7898d4654a843b9494259fc4ded68e59cf
|
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
2
|
require_relative 'action'
|
3
|
+
# require 'pry'
|
3
4
|
|
4
5
|
module Vagrant
|
5
6
|
module Commit
|
@@ -83,4 +84,69 @@ module Vagrant
|
|
83
84
|
end
|
84
85
|
end
|
85
86
|
end
|
87
|
+
|
88
|
+
module CopyBox
|
89
|
+
class Command < Vagrant.plugin('2', :command)
|
90
|
+
|
91
|
+
def metadata_json
|
92
|
+
<<-EOF
|
93
|
+
{
|
94
|
+
"provider": "libvirt",
|
95
|
+
"format": "qcow2",
|
96
|
+
"virtual_size": 32
|
97
|
+
}
|
98
|
+
EOF
|
99
|
+
end
|
100
|
+
|
101
|
+
def Vagrantfile
|
102
|
+
<<-EOF
|
103
|
+
Vagrant.configure("2") do |config|
|
104
|
+
config.vm.provider :libvirt do |libvirt|
|
105
|
+
libvirt.driver = "kvm"
|
106
|
+
libvirt.host = ""
|
107
|
+
libvirt.connect_via_ssh = false
|
108
|
+
libvirt.storage_pool_name = "default"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
user_vagrantfile = File.expand_path('../_include/Vagrantfile', __FILE__)
|
113
|
+
load user_vagrantfile if File.exists?(user_vagrantfile)
|
114
|
+
EOF
|
115
|
+
end
|
116
|
+
|
117
|
+
def execute
|
118
|
+
opts = OptionParser.new do |o|
|
119
|
+
o.banner = "Usage: vagrant copybox <source> <target>"
|
120
|
+
end
|
121
|
+
|
122
|
+
# Parse the options
|
123
|
+
argv = parse_options(opts)
|
124
|
+
src_boxname, target_boxname = argv
|
125
|
+
if !src_boxname || !target_boxname
|
126
|
+
raise Vagrant::Errors::CLIInvalidUsage,
|
127
|
+
help: opts.help.chomp
|
128
|
+
end
|
129
|
+
collection = Vagrant::BoxCollection.new(@env.boxes_path)
|
130
|
+
box = collection.find(src_boxname, :libvirt, "> 0")
|
131
|
+
provider = box.metadata["provider"]
|
132
|
+
|
133
|
+
# create necessary files in the boxes path
|
134
|
+
root_dir = @env.boxes_path
|
135
|
+
version = "0"
|
136
|
+
new_box_dir = root_dir.join(target_boxname).join(version).join(provider.to_s)
|
137
|
+
new_box_dir.mkpath
|
138
|
+
new_box_dir.join("metadata.json").open("w") do |f|
|
139
|
+
f.write(metadata_json())
|
140
|
+
end
|
141
|
+
new_box_dir.join("Vagrantfile").open("w") do |f|
|
142
|
+
f.write(Vagrantfile())
|
143
|
+
end
|
144
|
+
src_path = box.directory.join("box.img")
|
145
|
+
target_path = new_box_dir.join("box.img")
|
146
|
+
FileUtils.cp(src_path, target_path)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
|
86
152
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitalii Abetkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Vagrant plugin that does qemu-img commit
|
14
14
|
email:
|