hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.33k stars 4.44k forks source link

High Sierra issue while setting hostname #10348

Open mdeepa2285 opened 6 years ago

mdeepa2285 commented 6 years ago

Vagrant version

Vagrant 2.1.5

Host operating system

Mac High Sierra

Guest operating system

Mac High Sierra

Vagrantfile

Vagrant.require_version ">= 1.6.2"
VAGRANTFILE_API_VERSION = "2"
hostname = "#{`hostname | cut -d. -f1 | awk '{printf $0}'`}"
#hostname = Socket.gethostname[/^[^.]+/]
#localmachineip = IPSocket.getaddress(Socket.gethostname)
puts %Q{ This machine has the IP  and host name '#{hostname}'. }
BOX_NAME = "packer_virtualbox-ovf_virtualbox.box"
BOX_URL = "file:///Users/abc/" + BOX_NAME
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.network "public_network", bridge: "en0: Ethernet 1"
    config.ssh.username = "iosadmin"
    config.vm.define "node" do |node|
         node.vm.hostname = "#{hostname}-q3-1"
         node.vm.provider "virtualbox" do |vb|
                vb.name = "#{hostname}_q3_vm-1"
                vb.memory = 16384
                    vb.cpus = 2
            end
            puts "before configure network"
            # Forwarding SSH and VNC ports on VM. N.B., SSH (22) is already
            # forwarded to 2222. Keeping configuration line in for documentation.
            node.vm.network "forwarded_port", guest: 22, host: 2222, auto_correct: true
        end
end

Please note, if you are using Homestead or a different Vagrantfile format, we may be unable to assist with your issue. Try to reproduce the issue using a vanilla Vagrantfile first.

Debug output

https://gist.github.com/mdeepa2285/c2a92c69102b98398d9257e27e7cb8d7

Expected behavior

Modified hostname

Actual behavior

Error

Steps to reproduce

  1. vagaran up
briancain commented 6 years ago

@mdeepa2285 - Hey! Has this worked on any previous versions of macOS and or Vagrant for you in the past?

mdeepa2285 commented 6 years ago

Yes, this worked with previous macos, now we are in the process of upgrading Mac guest OS to high sierra and having this error.

mdeepa2285 commented 6 years ago

after commeting out node.vm.hostname = "#{hostname}-q3-1" , getting below error


The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

networksetup -detectnewhardware

Stdout from the command:

Stderr from the command:```