Return full pending computer name (#33483)

This commit is contained in:
Shane Lee 2016-05-25 10:26:21 -06:00 committed by Nicole Thomas
parent a89be5e9d4
commit 4f96cc1f54

View file

@ -287,7 +287,7 @@ def set_computer_name(name):
if windll.kernel32.SetComputerNameExW(win32con.ComputerNamePhysicalDnsHostname,
name):
ret = {'Computer Name': {'Current': get_system_info()['name']}}
ret = {'Computer Name': {'Current': get_computer_name()}}
pending = get_pending_computer_name()
if pending not in (None, False):
ret['Computer Name']['Pending'] = pending
@ -315,8 +315,8 @@ def get_pending_computer_name():
'''
current = get_computer_name()
pending = read_value('HKLM',
r'SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName',
'ComputerName')['vdata']
r'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters',
'NV Hostname')['vdata']
if pending:
return pending if pending != current else None
return False
@ -335,7 +335,7 @@ def get_computer_name():
salt 'minion-id' system.get_computer_name
'''
name = get_system_info()['name']
name = win32api.GetComputerNameEx(win32con.ComputerNamePhysicalDnsHostname)
return name if name else False