SmartOS support for setting hostnames [GH-1672]
This commit is contained in:
parent
e0f8114103
commit
7f32af980e
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- Setting hostnames works properly on SmartOS. [GH-1672]
|
||||||
- Better VBoxManage error detection on Windows systems. This avoids
|
- Better VBoxManage error detection on Windows systems. This avoids
|
||||||
some major issues where Vagrant would sometimes "lose" your VM. [GH-1669]
|
some major issues where Vagrant would sometimes "lose" your VM. [GH-1669]
|
||||||
- Better detection of missing VirtualBox kernel drivers on Linux
|
- Better detection of missing VirtualBox kernel drivers on Linux
|
||||||
|
|
|
@ -193,6 +193,8 @@ module Vagrant
|
||||||
#
|
#
|
||||||
# @param [String] value The ID.
|
# @param [String] value The ID.
|
||||||
def id=(value)
|
def id=(value)
|
||||||
|
@logger.info("New machine ID: #{value.inspect}")
|
||||||
|
|
||||||
# The file that will store the id if we have one. This allows the
|
# The file that will store the id if we have one. This allows the
|
||||||
# ID to persist across Vagrant runs.
|
# ID to persist across Vagrant runs.
|
||||||
id_file = @data_dir.join("id")
|
id_file = @data_dir.join("id")
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
module VagrantPlugins
|
||||||
|
module GuestSmartOS
|
||||||
|
module Cap
|
||||||
|
class ChangeHostName
|
||||||
|
def self.change_host_name(machine, name)
|
||||||
|
su_cmd = machine.config.solaris.suexec_cmd
|
||||||
|
|
||||||
|
# Only do this if the hostname is not already set
|
||||||
|
if !machine.communicate.test("#{su_cmd} hostname | grep '#{name}'")
|
||||||
|
machine.communicate.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
|
||||||
|
machine.communicate.execute("#{su_cmd} hostname #{name}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
require "vagrant"
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module GuestSmartOS
|
||||||
|
class Guest < Vagrant.plugin("2", :guest)
|
||||||
|
def detect?(machine)
|
||||||
|
machine.communicate.test("cat /etc/release | grep -i SmartOS")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,20 @@
|
||||||
|
require "vagrant"
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module GuestSmartOS
|
||||||
|
class Plugin < Vagrant.plugin("2")
|
||||||
|
name "SmartOS guest."
|
||||||
|
description "SmartOS guest support."
|
||||||
|
|
||||||
|
guest("smartos", "solaris") do
|
||||||
|
require File.expand_path("../guest", __FILE__)
|
||||||
|
Guest
|
||||||
|
end
|
||||||
|
|
||||||
|
guest_capability("smartos", "change_host_name") do
|
||||||
|
require_relative "cap/change_host_name"
|
||||||
|
Cap::ChangeHostName
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue