Call boxes list from a config.rb

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Call boxes list from a config.rb

Joris van der Kwast
Hi,

I'm, pretty new to ruby, but not vagrant. I'm setting up a config file in config.rb, as for instance the folks at coreos do (https://coreos.com/os/docs/latest/booting-on-vagrant.html#clone-vagrant-repo).

In my own adaption I want to get an array to list all boxes that are available, but not sure how to. If I call the vagrantfile, with require_relative config.rb, how would you call vagrant::BoxCollections #all?

On windows/7.

Thnx,


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/f733108c-0132-46ea-948a-4f3cb22b1c32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Call boxes list from a config.rb

Alvaro Miranda Aguilera
If you can share a git repo of what you got, will be easier to have a look.

On Fri, Jun 23, 2017 at 8:59 PM, Joris van der Kwast <[hidden email]> wrote:
Hi,

I'm, pretty new to ruby, but not vagrant. I'm setting up a config file in config.rb, as for instance the folks at coreos do (https://coreos.com/os/docs/latest/booting-on-vagrant.html#clone-vagrant-repo).

In my own adaption I want to get an array to list all boxes that are available, but not sure how to. If I call the vagrantfile, with require_relative config.rb, how would you call vagrant::BoxCollections #all?

On windows/7.

Thnx,


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/f733108c-0132-46ea-948a-4f3cb22b1c32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0eze9ubrdYmzjrVPkwmC5y_EijuTuYTuY50vCA-fmBn1tg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Call boxes list from a config.rb

Joris van der Kwast
Hi Alvaro,

Thank you fro your interest. I realized my total noobness to ruby and the vagrant code was the problem. So I did some reading and experimenting, and came up with a solution that works (although still clumpsy no doubt).

For completeness, I'll share what I came up with config.rb:

{
require "fileuitls"
require "vagrant"

# Clumpsy code, there must be a global to call
home_path = "#{ENV['HOME']}\\.vagrant.d\\boxes\\"
pn = Pathname.new(home_path)

boxes = Vagrant::BoxCollection::new(pn)
box = boxes.all

print "boxes = #{box} \n"
}

It works ;)


Op maandag 26 juni 2017 09:47:12 UTC+2 schreef Alvaro Miranda Aguilera:
If you can share a git repo of what you got, will be easier to have a look.

On Fri, Jun 23, 2017 at 8:59 PM, Joris van der Kwast <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="uFv1qj5VBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jvdk...@...> wrote:
Hi,

I'm, pretty new to ruby, but not vagrant. I'm setting up a config file in config.rb, as for instance the folks at coreos do (<a href="https://coreos.com/os/docs/latest/booting-on-vagrant.html#clone-vagrant-repo" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcoreos.com%2Fos%2Fdocs%2Flatest%2Fbooting-on-vagrant.html%23clone-vagrant-repo\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE5ASMOsJwH4FwFvfAsW48fOE8QwA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcoreos.com%2Fos%2Fdocs%2Flatest%2Fbooting-on-vagrant.html%23clone-vagrant-repo\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE5ASMOsJwH4FwFvfAsW48fOE8QwA&#39;;return true;">https://coreos.com/os/docs/latest/booting-on-vagrant.html#clone-vagrant-repo).

In my own adaption I want to get an array to list all boxes that are available, but not sure how to. If I call the vagrantfile, with require_relative config.rb, how would you call vagrant::BoxCollections #all?

On windows/7.

Thnx,


--
This mailing list is governed under the HashiCorp Community Guidelines - <a href="https://www.hashicorp.com/community-guidelines.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;">https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: <a href="https://github.com/mitchellh/vagrant/issues" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;">https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="uFv1qj5VBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vagrant-up+...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/vagrant-up/f733108c-0132-46ea-948a-4f3cb22b1c32%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/f733108c-0132-46ea-948a-4f3cb22b1c32%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/f733108c-0132-46ea-948a-4f3cb22b1c32%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/vagrant-up/f733108c-0132-46ea-948a-4f3cb22b1c32%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/12989d9e-1a6e-439d-98bb-f07a855147ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.