Remove NetBIOSName support from machine_name
Due to issues with setting this value (and presumably because we are not dealing with domain joining at this point), support for NetBIOSName and the plist modification is being removed. Not only was this value causing idempotence and convergence issues, but the changes were not reflected in the GUI and sometimes even the plist itself after it was modified and had been through testing. Signed-off-by: Eric Hanko <v-erhank@microsoft.com>
This commit is contained in:
Родитель
d8c42281a9
Коммит
f21c321c66
|
@ -20,7 +20,7 @@ platforms:
|
||||||
suites:
|
suites:
|
||||||
- name: default
|
- name: default
|
||||||
provisioner:
|
provisioner:
|
||||||
multiple_converge: 3
|
multiple_converge: 2
|
||||||
enforce_idempotency: true
|
enforce_idempotency: true
|
||||||
run_list:
|
run_list:
|
||||||
- recipe[macos::keep_awake]
|
- recipe[macos::keep_awake]
|
||||||
|
@ -36,7 +36,7 @@ suites:
|
||||||
|
|
||||||
- name: machine_name
|
- name: machine_name
|
||||||
provisioner:
|
provisioner:
|
||||||
multiple_converge: 3
|
multiple_converge: 2
|
||||||
enforce_idempotency: true
|
enforce_idempotency: true
|
||||||
run_list:
|
run_list:
|
||||||
- recipe[macos_test::machine_name]
|
- recipe[macos_test::machine_name]
|
||||||
|
|
|
@ -8,9 +8,6 @@ Use the **machine_name** resource to manage a machine's name. In theory, the
|
||||||
As defined by the `scutil` manual, an individual macOS system has three different
|
As defined by the `scutil` manual, an individual macOS system has three different
|
||||||
types of names managed by `scutil`: `ComputerName`, `LocalHostName`, and `HostName`.
|
types of names managed by `scutil`: `ComputerName`, `LocalHostName`, and `HostName`.
|
||||||
|
|
||||||
The fourth and lesser-known name, the **NetBIOS** name, will be set to an appropriately
|
|
||||||
formatted version of `HostName` by default unless otherwise set explicitly.
|
|
||||||
|
|
||||||
A `dns_domain` property can be optionally specified. This will be tacked on to the
|
A `dns_domain` property can be optionally specified. This will be tacked on to the
|
||||||
end of the specified `hostname` property to form a fully-qualified domain name
|
end of the specified `hostname` property to form a fully-qualified domain name
|
||||||
that the system `HostName` will be set to.
|
that the system `HostName` will be set to.
|
||||||
|
@ -35,7 +32,6 @@ which would set:
|
||||||
- `ComputerName` to **Johnny's MacBookPro**
|
- `ComputerName` to **Johnny's MacBookPro**
|
||||||
- `LocalHostName` to **Johnnys-MacBookPro**
|
- `LocalHostName` to **Johnnys-MacBookPro**
|
||||||
- `HostName` to **Johnnys-MacBookPro**
|
- `HostName` to **Johnnys-MacBookPro**
|
||||||
- `NetBIOS` name to **JOHNNYS-MACBOOK**.
|
|
||||||
|
|
||||||
The full syntax for all of the properties that are available to the **machine_name**
|
The full syntax for all of the properties that are available to the **machine_name**
|
||||||
resource is:
|
resource is:
|
||||||
|
@ -45,7 +41,6 @@ machine_name 'description' do
|
||||||
computer_name String # defaults to 'hostname' if not specified
|
computer_name String # defaults to 'hostname' if not specified
|
||||||
local_hostname String # defaults to 'hostname' if not specified
|
local_hostname String # defaults to 'hostname' if not specified
|
||||||
hostname String # defaults to the 'name' property if not specified
|
hostname String # defaults to the 'name' property if not specified
|
||||||
netbios_name String # defaults to 'hostname' if not specified
|
|
||||||
dns_domain String
|
dns_domain String
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
@ -71,15 +66,6 @@ Properties
|
||||||
|
|
||||||
The name associated with `hostname(1)` and `gethostname(3)`.
|
The name associated with `hostname(1)` and `gethostname(3)`.
|
||||||
|
|
||||||
`netbios_name`
|
|
||||||
|
|
||||||
**Ruby type:** `String`
|
|
||||||
|
|
||||||
The 16-byte address used to identify a NetBIOS
|
|
||||||
resource on the network. In the context of macOS, setting this can be helpful when
|
|
||||||
you need to identify a machine with certain network scanning tools such as `nmap`
|
|
||||||
or [Angry IP Scanner](http://angryip.org/).
|
|
||||||
|
|
||||||
`dns_domain`
|
`dns_domain`
|
||||||
|
|
||||||
**Ruby type:** `String`
|
**Ruby type:** `String`
|
||||||
|
@ -99,5 +85,3 @@ machine_name 'set computer/hostname' do
|
||||||
dns_domain 'vagrantup.com'
|
dns_domain 'vagrantup.com'
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** This would automatically set the NetBIOS name to JOHNNYS-MACPRO.
|
|
||||||
|
|
|
@ -3,19 +3,16 @@ resource_name :machine_name
|
||||||
property :hostname, String, desired_state: true, coerce: proc { |name| conform_to_dns_standards(name) }, required: true, name_property: true
|
property :hostname, String, desired_state: true, coerce: proc { |name| conform_to_dns_standards(name) }, required: true, name_property: true
|
||||||
property :computer_name, String, desired_state: true
|
property :computer_name, String, desired_state: true
|
||||||
property :local_hostname, String, desired_state: true, coerce: proc { |name| conform_to_dns_standards(name) }
|
property :local_hostname, String, desired_state: true, coerce: proc { |name| conform_to_dns_standards(name) }
|
||||||
property :netbios_name, String, desired_state: false, coerce: proc { |name| conform_to_dns_standards(name)[0, 15].upcase }
|
|
||||||
property :dns_domain, String, desired_state: false
|
property :dns_domain, String, desired_state: false
|
||||||
|
|
||||||
load_current_value do
|
load_current_value do
|
||||||
hostname current_hostname
|
hostname current_hostname
|
||||||
dns_domain current_dns_domain
|
dns_domain current_dns_domain
|
||||||
netbios_name shell_out(defaults_executable, 'read', '/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist', 'NetBIOSName').stdout.chomp
|
|
||||||
computer_name get_name('ComputerName')
|
computer_name get_name('ComputerName')
|
||||||
local_hostname get_name('LocalHostName')
|
local_hostname get_name('LocalHostName')
|
||||||
end
|
end
|
||||||
|
|
||||||
action :set do
|
action :set do
|
||||||
property_is_set?(:netbios_name) ? new_resource.netbios_name : new_resource.netbios_name = new_resource.hostname
|
|
||||||
property_is_set?(:computer_name) ? new_resource.computer_name : new_resource.computer_name = new_resource.hostname
|
property_is_set?(:computer_name) ? new_resource.computer_name : new_resource.computer_name = new_resource.hostname
|
||||||
property_is_set?(:local_hostname) ? new_resource.local_hostname : new_resource.local_hostname = new_resource.hostname
|
property_is_set?(:local_hostname) ? new_resource.local_hostname : new_resource.local_hostname = new_resource.hostname
|
||||||
|
|
||||||
|
@ -44,15 +41,6 @@ action :set do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
converge_if_changed :netbios_name do
|
|
||||||
converge_by 'set NetBIOSName name' do
|
|
||||||
defaults '/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist' do
|
|
||||||
settings 'NetBIOSName' => new_resource.netbios_name, 'ServerDescription' => new_resource.hostname
|
|
||||||
notifies :reload, 'ohai[reload ohai]'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
ohai 'reload ohai' do
|
ohai 'reload ohai' do
|
||||||
action :nothing
|
action :nothing
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче