saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.16k stars 5.48k forks source link

[BUG] salt return exitcode1 with pkg.installed on Windows, but App is installed #60263

Open yukpun opened 3 years ago

yukpun commented 3 years ago

Description I'm Trying to install Antivirus softwate on salt minion (Windows 10) Cortex, usign salt-call.bat

Setup

{% set version = '73120981' %}
{% set source_path = 'INTERNAL_COMPANY_URL' %}

cortex:
  '{{version}}':
    {% if grains['cpuarch'] == 'AMD64' %}
    installer: '{{source_path}}/WindowsAgent{{version|replace(".", "_")}}_x64.msi'
    uninstaller: '{{source_path}}/WindowsAgent{{version|replace(".", "_")}}_x64.msi'
    arch: x64
    {% else %}
    installer: '{{source_path}}/WindowsAgent{{version|replace(".", "_")}}_x86.msi'
    uninstaller: '{{source_path}}/WindowsAgent{{version|replace(".", "_")}}_x86.msi'
    arch: x86
    {% endif %}
    full_name: 'Cortex {{version}}'
    install_flags: '/qn /norestart'
    uninstall_flags: '/qn /norestart'
    msiexec: True
    locale: en_US
    reboot: False

Below state calls with this state:

install_cortex:
  pkg.installed:
    - name: cortex

Steps to Reproduce the behavior I tried install it on clean Windows 10 with CMD

C:\salt>salt-call.bat state.sls cortex
[ERROR   ] {'cortex': {'install status': 'success'}, 'Cortex XDR 7.3.1.20981': {'old': '', 'new': '7.3.1.20981'}}
local:
----------
          ID: install_cortex
    Function: pkg.installed
        Name: cortex
      Result: False
     Comment: The following packages failed to install/update: cortex
     Started: 20:07:05.612151
    Duration: 109018.207 ms
     Changes:
              ----------
              Cortex XDR 7.3.1.20981:
                  ----------
                  new:
                      7.3.1.20981
                  old:
              cortex:
                  ----------
                  install status:
                      success

Summary for local
------------
Succeeded: 0 (changed=1)
Failed:    1
------------
Total states run:     1
Total run time: 109.018 s

Expected behavior I expect no ERROR message here, since antivirus application installs and works fine after this

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ``` Salt Version: Salt: 3003 Dependency Versions: cffi: 1.12.3 cherrypy: unknown dateutil: 2.6.1 docker-py: 3.7.3 gitdb: 2.0.3 gitpython: 2.1.8 Jinja2: 2.10 libgit2: 1.1.0 M2Crypto: Not Installed Mako: Not Installed msgpack: 0.5.6 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.19 pycrypto: 2.6.1 pycryptodome: 3.4.7 pygit2: 1.5.0 Python: 3.6.9 (default, Jan 26 2021, 15:33:00) python-gnupg: 0.4.1 PyYAML: 3.12 PyZMQ: 17.1.2 smmap: 2.0.3 timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.2.5 System Versions: dist: ubuntu 18.04 Bionic Beaver locale: UTF-8 machine: x86_64 release: 5.0.0-27-generic system: Linux version: Ubuntu 18.04 Bionic Beaver ```

Additional context Weird thing - I tried to run salt state from master using salt pkg.install - and it was executed without errors.

welcome[bot] commented 3 years ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

xeacott commented 3 years ago

Weird thing - I tried to run salt state from master using salt pkg.install - and it was executed without errors.

Perhaps the difference here is the command executed with the salt master has a better handle on the return, i do believe there was another issue highly similar to this just from a few weeks ago... let me go find it

https://github.com/saltstack/salt/issues/58739

maybe related..

garethgreenaway commented 3 years ago

@yukpun Following up on this one and making sure you saw @xeacott's comments above?

yukpun commented 3 years ago

@yukpun Following up on this one and making sure you saw @xeacott's comments above?

I've asked in that issue, and didn't receive answer yet. https://github.com/saltstack/salt/issues/58739#issuecomment-863133872

xeacott commented 3 years ago

Hey @yukpun let me know if you could assist me in the other ticket referenced.

xeacott commented 3 years ago

Also I am going to mark this ticket as low-priority as it looks like the install succeeded and the outcome is what you desired, but it's just updating the dictionary incorrectly