saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.18k stars 5.48k forks source link

[BUG] win_network.managed not updating adapter #58138

Open rosscdh opened 4 years ago

rosscdh commented 4 years ago

Description Network Adapter not able to be referenced by name

Setup setup a network.managed state for a windows minion

hwa exists

salt lab.ws02 network.hw_addr 'Realtek PCIe GBE Family Controller'
lab.ws02:
    00:19:99:F1:7B:9A

Steps to Reproduce the behavior

          ID: install_net_adapter_'434355045'
    Function: network.managed
        Name: Realtek PCIe GBE Family Controller
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "c:\salt\bin\lib\site-packages\salt-3001-py3.7.egg\salt\state.py", line 2154, in call
                  *cdata["args"], **cdata["kwargs"]
                File "c:\salt\bin\lib\site-packages\salt-3001-py3.7.egg\salt\loader.py", line 2087, in wrapper
                  return f(*args, **kwargs)
                File "c:\salt\bin\lib\site-packages\salt-3001-py3.7.egg\salt\states\win_network.py", line 321, in managed
                  if not __salt__["ip.enable"](name):
                File "c:\salt\bin\lib\site-packages\salt-3001-py3.7.egg\salt\modules\win_ip.py", line 174, in enable
                  if is_enabled(iface):
                File "c:\salt\bin\lib\site-packages\salt-3001-py3.7.egg\salt\modules\win_ip.py", line 147, in is_enabled
                  raise CommandExecutionError("Interface '{0}' not found".format(iface))
              salt.exceptions.CommandExecutionError: Interface 'Realtek PCIe GBE Family Controller' not found
     Started: 16:05:17.473680
    Duration: 197.266 ms

Expected behavior network adapter is configured as desired

Screenshots If applicable, add screenshots to help explain your problem.

Versions Report

/ # salt --versions-report
Salt Version:
           Salt: 3001

Dependency Versions:
           cffi: 1.14.0
       cherrypy: unknown
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: 4.0.5
      gitpython: 3.1.7
         Jinja2: 2.11.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: 2.20
       pycrypto: Not Installed
   pycryptodome: 3.9.8
         pygit2: Not Installed
         Python: 3.7.8 (default, Jun 30 2020, 19:02:38)
   python-gnupg: Not Installed
         PyYAML: 5.3.1
          PyZMQ: 19.0.1
          smmap: 3.0.4
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: alpine 3.12.0
         locale: UTF-8
        machine: x86_64
        release: 4.19.0-9-amd64
         system: Linux
        version: Alpine Linux 3.12.0
PASTE HERE

Additional context Add any other context about the problem here.

garethgreenaway commented 4 years ago

@cmcmarrow FYI.

rosscdh commented 4 years ago

Or does it rather expect the "other" windows name "Ethernet" ?

rosscdh commented 4 years ago

This looks to be related to the bug i filed today about language https://github.com/saltstack/salt/issues/58361

twangboy commented 4 years ago

@cmcmarrow Looks like we may need to look at rewriting the win_network module to use pywin32 or dotNET to avoid the localization issues.