vagrant-mos 0.8.83 → 0.8.84

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e594224be6917e4e46e6aa414b38d863195c1b3
4
- data.tar.gz: 96dfa51f7e102a4cbf12a112dfd174c9f058cd37
3
+ metadata.gz: 641d12917317f2c12b3505ed1b77838bc1761ab6
4
+ data.tar.gz: b349513e0bef223892c7fb449c0c39f90c50d764
5
5
  SHA512:
6
- metadata.gz: 53a335d98f501c129023ff8149dfa743c6009511fd656df2f89ef3446d72d698b0603b7fb42ce83e80aaf8326b5d3683154c19525c7b8e37990107fa7f02e091
7
- data.tar.gz: c6311faee37e9c402987e133f19263a841369a97dae13d915f34b088745a7a586c8e5442d3b3648bd9816ae6f59e7c0c70b37cd436a5587115f7e146354fd5d2
6
+ metadata.gz: 735e13bb2668743cda4c79c020bb386de221a076b1fba6bc395511efdd26d663b62139d3e95499fa1bcf05eb2f43fd7ebcd7d1da9ba95a9561411b44eec9efdd
7
+ data.tar.gz: 5eb29360dd5134d8517f3384963ae268330d33ccb22f28b1c14826d659506283c586939caa629474ea3fb800b29868860bd17736a8809eb009ccd132272d4a30
@@ -115,6 +115,7 @@ module VagrantPlugins
115
115
 
116
116
  def self.action_prepare_boot
117
117
  Vagrant::Action::Builder.new.tap do |b|
118
+ b.use SetName
118
119
  b.use Provision
119
120
  b.use SyncedFolders
120
121
  b.use WarnNetworks
@@ -176,6 +177,7 @@ module VagrantPlugins
176
177
  autoload :ConnectMOS, action_root.join("connect_mos")
177
178
  autoload :IsCreated, action_root.join("is_created")
178
179
  autoload :IsStopped, action_root.join("is_stopped")
180
+ autoload :SetName, action_root.join("set_name")
179
181
  autoload :MessageAlreadyCreated, action_root.join("message_already_created")
180
182
  autoload :MessageNotCreated, action_root.join("message_not_created")
181
183
  autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
@@ -0,0 +1,55 @@
1
+ require "log4r"
2
+
3
+ module VagrantPlugins
4
+ module MOS
5
+ module Action
6
+ class SetName
7
+ def initialize(app, env)
8
+ @logger = Log4r::Logger.new("vagrant::action::vm::setname")
9
+ @app = app
10
+ end
11
+
12
+ def call(env)
13
+ name = env[:machine].provider_config.name
14
+
15
+ # If we already set the name before, then don't do anything
16
+ sentinel = env[:machine].data_dir.join("action_set_name")
17
+ if !name && sentinel.file?
18
+ @logger.info("Default name was already set before, not doing it again.")
19
+ return @app.call(env)
20
+ end
21
+
22
+ # If no name was manually set, then use a default
23
+ if !name
24
+ prefix = "#{env[:root_path].basename.to_s}_#{env[:machine].name}"
25
+ prefix.gsub!(/[^-a-z0-9_]/i, "")
26
+
27
+ # milliseconds + random number suffix to allow for simultaneous
28
+ # `vagrant up` of the same box in different dirs
29
+ name = prefix + "_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
30
+ end
31
+
32
+ ## Verify the name is not taken
33
+ #vms = env[:machine].provider.driver.read_vms
34
+ #raise Vagrant::Errors::VMNameExists, name: name if \
35
+ # vms.key?(name) && vms[name] != env[:machine].id
36
+ #
37
+ #if vms.key?(name)
38
+ # @logger.info("Not setting the name because our name is already set.")
39
+ #else
40
+ # env[:ui].info(I18n.t(
41
+ # "vagrant.actions.vm.set_name.setting_name", name: name))
42
+ # env[:machine].provider.driver.set_name(name)
43
+ #end
44
+
45
+ # Create the sentinel
46
+ sentinel.open("w") do |f|
47
+ f.write(Time.now.to_i.to_s)
48
+ end
49
+
50
+ @app.call(env)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module MOS
3
- VERSION = '0.8.83'
3
+ VERSION = '0.8.84'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-mos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.83
4
+ version: 0.8.84
5
5
  platform: ruby
6
6
  authors:
7
7
  - yangcs2009
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-23 00:00:00.000000000 Z
11
+ date: 2015-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -121,6 +121,7 @@ files:
121
121
  - lib/vagrant-mos/action/read_ssh_info.rb
122
122
  - lib/vagrant-mos/action/read_state.rb
123
123
  - lib/vagrant-mos/action/run_instance.rb
124
+ - lib/vagrant-mos/action/set_name.rb
124
125
  - lib/vagrant-mos/action/start_instance.rb
125
126
  - lib/vagrant-mos/action/stop_instance.rb
126
127
  - lib/vagrant-mos/action/terminate_instance.rb