[LRUG] Noob question re: vagrantfile

Tom Stuart tom at codon.com
Thu Feb 1 01:09:13 PST 2018


On 1 Feb 2018, at 00:28, Mark Burns <markthedeveloper at gmail.com> wrote:
> I think it should be machine[‘image’] instead of machine_id[‘image’]

I agree that this is the problem.

Tangentially: is the mapping from numbers (the variable `i`) to each hash (`machine`) important? It’s hard to tell since your example code doesn’t use `i` at all, but maybe `i` shows up in the unimportant parts you didn’t include. Anyway, if it’s not important for you to be able to control `i`, it might make more sense for `cluster` to be an _array_ of hashes, which you can then iterate over with `cluster.each_with_index do |machine, i|` if you still want to have a unique `i` available inside each iteration of the block.

Cheers,
-Tom


More information about the Chat mailing list