@@ 103-111 (lines=9) @@ | ||
100 | if (empty($groupDef->details->machines)) { |
|
101 | throw Exceptions::newActionFailedException(__METHOD__, "groupDef->details->machines cannot be empty"); |
|
102 | } |
|
103 | foreach($groupDef->details->machines as $hostId => $machine) { |
|
104 | // TODO: it would be great to autodetect this one day |
|
105 | if (!isset($machine->roles)) { |
|
106 | throw Exceptions::newActionFailedException(__METHOD__, "missing groupDef->details->machines['$hostId']->roles"); |
|
107 | } |
|
108 | if (!isset($machine->ipAddress)) { |
|
109 | throw Exceptions::newActionFailedException(__METHOD__, "missing groupDef->details->machines['$hostId']->ipAddress"); |
|
110 | } |
|
111 | } |
|
112 | ||
113 | // remove any existing hosts table entry |
|
114 | foreach ($groupDef->details->machines as $hostId => $machine) { |
@@ 144-152 (lines=9) @@ | ||
141 | $baseFolder = $this->getVagrantDir($groupDef); |
|
142 | ||
143 | // make sure we're happy with details about the machine |
|
144 | foreach($groupDef->details->machines as $hostId => $machine) { |
|
145 | // TODO: it would be great to autodetect this one day |
|
146 | if (!isset($machine->osName)) { |
|
147 | throw Exceptions::newActionFailedException(__METHOD__, "missing groupDef->details->machines['$hostId']->osName"); |
|
148 | } |
|
149 | if (!isset($machine->roles)) { |
|
150 | throw Exceptions::newActionFailedException(__METHOD__, "missing groupDef->details->machines['$hostId']->roles"); |
|
151 | } |
|
152 | } |
|
153 | ||
154 | // make sure the VM is stopped, if it is running |
|
155 | $log->addStep('stop vagrant VM in '.$baseFolder.' if already running', function() use($baseFolder) { |