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

Fixes #1605: Randomize DrupalVM IP address. #1606

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/drupal-vm/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ vagrant_hostname: ${project.local.hostname}
vagrant_machine_name: ${project.machine_name}

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

# Use Ubuntu 14.04 LTS to more closely match Acquia Cloud environment.
vagrant_box: geerlingguy/ubuntu1404
Expand Down
7 changes: 6 additions & 1 deletion src/Robo/Commands/Vm/VmCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ public function config() {
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();

$this->getConfig()->expandFileProperties($this->projectDrupalVmConfigFile);
// Generate a Random IP address for the new VM.
$config = clone $this->getConfig();
$random_local_ip = "192.168." . rand(0, 255) . '.' . rand(0, 255);
$config->set('random.ip', $random_local_ip);

$config->expandFileProperties($this->projectDrupalVmConfigFile);
$vm_config = Yaml::parse(file_get_contents($this->projectDrupalVmConfigFile));
$this->validateConfig($vm_config);

Expand Down