Last modified: 2014-07-10 00:17:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T69445, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 67445 - Custom vagrant commands don't run from subdirs
Custom vagrant commands don't run from subdirs
Status: RESOLVED FIXED
Product: MediaWiki-Vagrant
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Normal major
: ---
Assigned To: Dan Duvall
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-03 00:56 UTC by Yuri Astrakhan
Modified: 2014-07-10 00:17 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Yuri Astrakhan 2014-07-03 00:56:45 UTC
On Win 8.1 x64, vagrant 1.6.3, after running I748655162214e0 - setup.bat to get all the custom commands.

Custom commands such as list-roles, enable-role, etc work ok from the root Vagrant dir, but fail when executed from subdirectories:

cd v  (vagrant dir)
$ vagrant list-roles
   ... works ok

$ cd mediawiki
$ vagrant list-roles
Available roles:

C:/Users/user/.vagrant.d/gems/gems/mediawiki-vagrant-0.0.3/lib/mediawiki-vagrant/roles.rb:12:in `each_slice': invalid slice size (ArgumentEr
ror)
        from C:/Users/user/.vagrant.d/gems/gems/mediawiki-vagrant-0.0.3/lib/mediawiki-vagrant/roles.rb:12:in `execute'
        from c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/cli.rb:42:in `execute'
        from c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:252:in `cli'
        from c:/HashiCorp/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:166:in `<main>'
Comment 1 Bryan Davis 2014-07-03 18:18:15 UTC
This have been my experience on OS X with the plugin based system as well. I'm pretty sure this is caused by the changes in Vagrant 1.6 that cause the plugins to be loaded before the contents of Vagrantfile.
Comment 2 Dan Duvall 2014-07-03 18:43:26 UTC
It's likely symptomatic of inconsistent initialization of the $DIR global between older versions of Vagrant and 1.6—related to the inconsistent loading of the plugin, as Bryan mentioned.

When using a pre-1.6 version, the plugin was loaded by the Vagrantfile after it had initialized $DIR to the parent directory. In 1.6, the plugin is loaded first and initializes $DIR to the current working directory. The latter scenario leads to a failure to find the vagrant-managed.pp manifest that stores enabled-role state.

I think refactoring the roles implementation to derive the directory from the Vagrant::Environment is the way to go here. While I'm at it, I'll see about removing the other globals to avoid these types of race conditions in the future.
Comment 3 Ori Livneh 2014-07-03 19:17:29 UTC
One unfortunate consequence of the subcommands-as-gem approach is that the subcommands are present for vagrant everywhere; they are not scoped to the mediawiki-vagrant directory tree. So if you try to "vagrant enable-role hhvm" (for example) outside the mediawiki-vagrant tree, you get "'hhvm' is not a valid role.", which is a bit bizarre.
If you invoke 'vagrant list-roles', it's even worse: you get: /Users/ori/.vagrant.d/gems/gems/mediawiki-vagrant-0.0.1/lib/mediawiki-vagrant/roles.rb:12:in `each_slice': invalid slice size (ArgumentError)
Comment 4 Yuri Astrakhan 2014-07-03 20:24:37 UTC
With all the trouble with the custom commands in 1.6+, would it make sense to try to convince Vagrant team to bring back/implement per-project custom command support?
Comment 5 Bryan Davis 2014-07-03 21:12:11 UTC
(In reply to Yuri Astrakhan from comment #4)
> With all the trouble with the custom commands in 1.6+, would it make sense
> to try to convince Vagrant team to bring back/implement per-project custom
> command support?

Yes. Several of us have been trying to keep the issue alive at https://github.com/mitchellh/vagrant/issues/3775
Comment 6 Gerrit Notification Bot 2014-07-04 00:25:14 UTC
Change 144102 had a related patch set uploaded by Dduvall:
Factored out globals and refactored helpers

https://gerrit.wikimedia.org/r/144102
Comment 7 Gerrit Notification Bot 2014-07-10 00:11:47 UTC
Change 144102 merged by jenkins-bot:
Factored out globals and refactored helpers

https://gerrit.wikimedia.org/r/144102
Comment 8 Bryan Davis 2014-07-10 00:17:44 UTC
Requires reinstalling the mediawiki-vagrant plugin to get the latest code:

    vagrant plugin uninstall mediawiki-vagrant
    gem build mediawiki-vagrant.gemspec
    vagrant plugin install mediawiki-vagrant-0.0.3.gem

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links