diff --git a/lib/vagrant-hostsupdater/Action/BaseAction.rb b/lib/vagrant-hostsupdater/Action/BaseAction.rb index b728400..61d3c5e 100644 --- a/lib/vagrant-hostsupdater/Action/BaseAction.rb +++ b/lib/vagrant-hostsupdater/Action/BaseAction.rb @@ -21,9 +21,14 @@ def initialize(app, env) end def call(env) - if not @@completed.key?(self.class.name) + # Check whether the plugin has been executed for a particular + # VM as it may happen that a single Vagrantfile defines multiple + # machines and having a static flag will result in a plugin being + # executed just once. + # https://github.com/agiledivider/vagrant-hostsupdater/issues/198 + if not @@completed.key?(@machine.name) run(env) - @@completed[self.class.name] = true + @@completed[@machine.name] = true end @app.call(env)