vagrant-commit 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/vagrant-commit/command.rb +12 -8
- data/lib/vagrant-commit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f17a6c13e9b073d04c374fce119854900b35cc67ac51428574945cab4bdae5
|
4
|
+
data.tar.gz: f77225cdb10d2c76f499f5c5934610dba7925e768bc49498d5e28f495abdd90d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bff04b0591a5808e6682c1baa6b60a47bd68c6eedce96506e45f6f494be1a1a6f9cd25d4d9eaabad229f2e7f2bcd2c02cdcbe4fb77a176c8d3be669052dd6079
|
7
|
+
data.tar.gz: e31dd7568dd7146c415f7df36a34c8a2450687fca5b1bfd33defcb2b0835f40c2cefbfc98502b177e9821b1894b343dd8551f247a8feb54d50d5b98cb6ee5309
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
Current way to install (execute in current directory):
|
2
2
|
|
3
3
|
```
|
4
|
-
|
5
|
-
vagrant plugin install ./vagrant-commit-0.5.6.gem
|
4
|
+
vagrant plugin install vagrant-commit
|
6
5
|
```
|
7
6
|
|
8
7
|
Usage:
|
9
8
|
|
10
9
|
```
|
11
|
-
vagrant
|
10
|
+
vagrant copybox generic/ubuntu1904 mybox
|
11
|
+
vagrant init mybox
|
12
|
+
vagrant commit
|
12
13
|
```
|
@@ -128,18 +128,25 @@ module Vagrant
|
|
128
128
|
end
|
129
129
|
collection = Vagrant::BoxCollection.new(@env.boxes_path)
|
130
130
|
box = collection.find(src_boxname, :libvirt, "> 0")
|
131
|
+
if !box
|
132
|
+
@env.ui.error("Box #{src_boxname} not found")
|
133
|
+
return 1
|
134
|
+
end
|
131
135
|
provider = box.metadata["provider"]
|
132
136
|
|
133
137
|
# create necessary files in the boxes path
|
134
138
|
root_dir = @env.boxes_path
|
135
139
|
version = "0"
|
136
140
|
new_box_dir = root_dir.join(target_boxname).join(version).join(provider.to_s)
|
137
|
-
existing_box_found = false
|
138
141
|
if File.exist?(new_box_dir)
|
139
|
-
|
140
|
-
ans
|
141
|
-
|
142
|
-
|
142
|
+
ans = @env.ui.ask("Box #{target_boxname} exists. What to do? [use/remove/exit] ")
|
143
|
+
if ans.strip.downcase == "use"
|
144
|
+
return 0
|
145
|
+
elsif ans.strip.downcase == "remove"
|
146
|
+
FileUtils.rm_rf(new_box_dir)
|
147
|
+
@env.ui.info("Box removed. You probably want to run vagrant fulldestroy.")
|
148
|
+
end
|
149
|
+
return 1
|
143
150
|
end
|
144
151
|
new_box_dir.mkpath
|
145
152
|
new_box_dir.join("metadata.json").open("w") do |f|
|
@@ -151,9 +158,6 @@ module Vagrant
|
|
151
158
|
src_path = box.directory.join("box.img")
|
152
159
|
target_path = new_box_dir.join("box.img")
|
153
160
|
FileUtils.cp(src_path, target_path)
|
154
|
-
if existing_box_found
|
155
|
-
@env.ui.info("Box recreated. You probably want to run vagrant fulldestroy to use the new box.")
|
156
|
-
end
|
157
161
|
end
|
158
162
|
end
|
159
163
|
end
|