saltstack/salt

Windows firewall state can fail while returning True

Open

#53,618 建立於 2019年6月27日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Python (13,710 star) (5,508 fork)batch import
Windowsbuggood first issueseverity-high

描述

Description of Issue

In some situations the win_firewall.add_rule state can return True after actually failing.

Setup

I created a test state sls file called firewall_fail.sls. It's contents is as follows:

Open firewall rdp port:
    win_firewall.add_rule:
       - name: RDP_test (3389)
       - localport: 3389
       - protocol: any
       - action: allow

Steps to Reproduce Issue

I ran the command:

salt win_minion state.apply firewall_fail

The output looks like this:

win_minion:
----------
          ID: Open firewall rdp port
    Function: win_firewall.add_rule
        Name: RDP_test (3389)
      Result: True
     Comment: Could not add rule
     Started: 19:55:35.018958
    Duration: 527.399 ms
     Changes:   
              ----------
              new rule:
                  RDP_test (3389)

Notice that the changes dictionary makes it look like the new rule was added, but the comment indicates what really happened (AFAICS no new rule was added). Furthermore the result was True when it should have been False.

Versions Report

The output from salt --versions-report is as follows:

Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: 1.11.5
       cherrypy: Not Installed
       dateutil: 2.7.5
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.1
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.7.3 (default, May 11 2019, 00:45:16)
   python-gnupg: Not Installed
         PyYAML: 5.1
          PyZMQ: 17.0.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.6
 
System Versions:
           dist: fedora 29 Twenty Nine
         locale: UTF-8
        machine: x86_64
        release: 5.1.8-200.fc29.x86_64
         system: Linux
        version: Fedora 29 Twenty Nine

The minion that this was tested on is running salt version 2019.2.0, Python 3 64 bit.

貢獻者指南