Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 6cb220b

Browse files
authored
Fixes #1605: Randomize DrupalVM IP address. (#1606)
1 parent 62e3f7e commit 6cb220b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

scripts/drupal-vm/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ vagrant_hostname: ${project.local.hostname}
33
vagrant_machine_name: ${project.machine_name}
44

55
# Set the IP address so it doesn't conflict with other Drupal VM instances.
6-
vagrant_ip: 192.168.25.8
6+
vagrant_ip: ${random.ip}
77

88
# Use Ubuntu 14.04 LTS to more closely match Acquia Cloud environment.
99
vagrant_box: geerlingguy/ubuntu1404

src/Robo/Commands/Vm/VmCommand.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,12 @@ public function config() {
139139
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
140140
->run();
141141

142-
$this->getConfig()->expandFileProperties($this->projectDrupalVmConfigFile);
142+
// Generate a Random IP address for the new VM.
143+
$config = clone $this->getConfig();
144+
$random_local_ip = "192.168." . rand(0, 255) . '.' . rand(0, 255);
145+
$config->set('random.ip', $random_local_ip);
146+
147+
$config->expandFileProperties($this->projectDrupalVmConfigFile);
143148
$vm_config = Yaml::parse(file_get_contents($this->projectDrupalVmConfigFile));
144149
$this->validateConfig($vm_config);
145150

0 commit comments

Comments
 (0)