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:
Eric Hanko 2018-03-12 15:29:10 -07:00
Родитель d8c42281a9
Коммит f21c321c66
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 6DD04E7D76C3271B
3 изменённых файлов: 2 добавлений и 30 удалений

Просмотреть файл

@ -20,7 +20,7 @@ platforms:
suites:
- name: default
provisioner:
multiple_converge: 3
multiple_converge: 2
enforce_idempotency: true
run_list:
- recipe[macos::keep_awake]
@ -36,7 +36,7 @@ suites:
- name: machine_name
provisioner:
multiple_converge: 3
multiple_converge: 2
enforce_idempotency: true
run_list:
- 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
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
end of the specified `hostname` property to form a fully-qualified domain name
that the system `HostName` will be set to.
@ -35,7 +32,6 @@ which would set:
- `ComputerName` to **Johnny's MacBookPro**
- `LocalHostName` 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**
resource is:
@ -45,7 +41,6 @@ machine_name 'description' do
computer_name 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
netbios_name String # defaults to 'hostname' if not specified
dns_domain String
end
```
@ -71,15 +66,6 @@ Properties
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The name associated with `hostname(1)` and `gethostname(3)`.
`netbios_name`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**Ruby type:** `String`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**Ruby type:** `String`
@ -99,5 +85,3 @@ machine_name 'set computer/hostname' do
dns_domain 'vagrantup.com'
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 :computer_name, String, desired_state: true
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
load_current_value do
hostname current_hostname
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')
local_hostname get_name('LocalHostName')
end
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?(:local_hostname) ? new_resource.local_hostname : new_resource.local_hostname = new_resource.hostname
@ -44,15 +41,6 @@ action :set do
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
action :nothing
end