pkg.installed on windows fail but the package installs succesfull
Description of Issue/Question
When using the state pkg.installed in windows the state gives an error code but the indicated package is installed correctly.
I recently updated to 2018.3.2 and to date it worked correctly.
Setup
# Instalamos agente winlogbeat
winlogbeat:
pkg.installed:
- pkgs:
- winlogbeat
- refresh: True
Steps to Reproduce Issue
[DEBUG ] Rendered data from file: c:\salt\var\cache\salt\minion\files\base\win\repo-ng\winlogbeat.sls:
# Winlogbeat:
# Collect Windows Event Logs
# Harness the richness of system, application, and security information from
# Windows event logs using a lightweight Winlogbeat data collector.
# Ship events directly to Elasticsearch or parse and enrich them using Logstash
# prior to visualizing results in Kibana.
# URL: https://www.elastic.co/downloads/beats/winlogbeat
winlogbeat:
latest:
full_name: 'Winlogbeat 1.3.1'
installer: 'salt://win/repo-ng/winlogbeat/winlogbeat_1_3_1_7zip.exe'
msiexec: False
locale: en_US
reboot: False
'1.3.1':
full_name: 'Winlogbeat 1.3.1'
installer: 'salt://win/repo-ng/winlogbeat/winlogbeat_1_3_1_7zip.exe'
msiexec: False
locale: en_US
reboot: False
'1.0.1':
full_name: 'Winlogbeat 1.0.1'
installer: 'salt://win/repo-ng/winlogbeat/winlogbeat_1_0_1_7zip.exe'
msiexec: False
locale: en_US
reboot: False
----------
ID: winlogbeat
Function: pkg.installed
Result: False
Comment: The following packages failed to install/update: winlogbeat
Started: 11:56:26.888000
Duration: 3000.0 ms
Changes:
----------
winlogbeat:
----------
install status:
success
c:\Admin>dir winlogbeat
Volume in drive C has no label.
Volume Serial Number is 9EBB-EFF8
Directory of c:\Admin\winlogbeat
08/10/2018 11:56 <DIR> .
08/10/2018 11:56 <DIR> ..
08/10/2018 11:56 132 .winlogbeat.yml
08/10/2018 11:56 <DIR> Logs
14/09/2016 22:21 8.926.208 winlogbeat.exe
14/09/2016 22:21 728 winlogbeat.template.json
08/10/2018 11:56 10.136 winlogbeat.yml
4 File(s) 8.937.204 bytes
3 Dir(s) 87.205.928.960 bytes free
I have more states to distribute agents on the windows machines and they all return the same error:
ID: check-mk-agent
Function: pkg.installed
Result: False
Comment: The following packages failed to install/update: check_mk
Started: 11:59:57.922000
Duration: 5761.0 ms
Changes:
----------
check_mk:
----------
install status:
success
Versions Report
master
root@master ~> salt --versions-report
Salt Version:
Salt: 2018.3.2
Dependency Versions:
cffi: 1.11.5
cherrypy: unknown
dateutil: 2.7.3
docker-py: Not Installed
gitdb: 2.0.4
gitpython: 2.1.11
ioflo: Not Installed
Jinja2: 2.8.1
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: 2.18
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.13 (default, Jul 12 2017, 17:32:34)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.5.0
RAET: Not Installed
smmap: 2.0.4
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.0.5
System Versions:
dist: centos 6.9 Santiago
locale: ANSI_X3.4-1968
machine: x86_64
release: 2.6.32-696.6.3.el6.x86_64
system: Linux
version: Red Hat Enterprise Linux Server 6.9 Santiago
minion
Salt Version:
Salt: 2018.3.2
Dependency Versions:
cffi: 1.10.0
cherrypy: 10.2.1
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.3
ioflo: Not Installed
Jinja2: 2.9.6
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 1.0.6
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: 2.17
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)]
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 16.0.3
RAET: Not Installed
smmap: 2.0.3
timelib: 0.2.4
Tornado: 4.5.1
ZMQ: 4.1.6
System Versions:
dist:
locale: cp1252
machine: AMD64
release: 2012ServerR2
system: Windows
version: 2012ServerR2 6.3.9600 Multiprocessor Free
2018.3.3 most likely has a fix for your issue. As the output has changed.
PS - refresh: True is a bad idea. It handles it automatically (unless your testing a new package definition)
@damon-atkins Thanks a lot!! I'll wait for version 2018.3.3.
PS: I know that refresh: True its a bad idea but
but the windows' group only delegates in salt the deployment of the basic agents. The rest is distributed via the System Center. Therefore, the packages do not vary much.
Note: Python 3 has better windows compatibility due to the newer Windows Interface it uses.
Next major release windows package manager in 2019 hope win over a few people using MS SC.
@PabloLemos I would remove the entire entry for latest. That's a keyword reserved for software downloads that only supply a single url to their product that is the latest version... you can't download earlier versions. Google Chrome for example.
Good point @twangboy. @PabloLemos latest is calculated has the highest version number listed in the package definition.
I still see this issue with salt-minion 2018.3.3 Py3 on Windows.
@PabloLemos I just looked at the installer for winlogbeat. It's apparently just a zip file. I'm assuming you repackaged it to be a self-extracting zip or something. So, though it is completing successfully by copying the files, it's not actually installing as expected by salt. Salt looks in the registry for what is installed on the system. So, if you want this to work, you'll need to write some registry entries the following location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
winlogbeat should really have a valid windows installer.
I tried finding an installer for check_mk but could only find source code, so I can't troubleshoot that.
@gurubert Do you have the state file and the software definition file you're having problems with?
This is in the .sls file:
check-mk-agent-msi:
pkg.installed:
- version: 1.5.0.3268
This is the definition from salt-winrepo-ng:
check-mk-agent-msi:
{% for version in ['1.5.0.3268', '1.4.0.2940', '1.4.0.2857', '1.4.0p15', '1.2.8.1521', '1.2.8p26', '1.2.8b4', '1.2.8b3', '1.2.8b2', '1.2.8b1', '1.2.7i3p5', '1.2.7i3p4', '1.2.7i3p3', '1.2.7i3p2', '1.2.7i3p1', '1.2.6.185', '1.2.6p16', '1.2.6p15', '1.2.6p14', '1.2.6p13', '1.2.6p12'] %}
'{{ version }}':
full_name: 'Check_MK Agent {{ version }}'
installer: 'salt://win/repo-ng/check_mk/check_mk_agent-{{ version }}.msi'
install_flags: '/qn /norestart'
uninstaller: 'salt://win/repo-ng/check_mk/check_mk_agent-{{ version }}.msi'
uninstall_flags: '/qn /norestart'
msiexec: True
locale: en_US
reboot: False
{% endfor %}
The MSI is available here: https://share.mailbox.org/ajax/share/02e1fcd90ab311532961aceab3114a02beb376166bc1ff0d/1/8/ODc
@gurubert I just installed this on my box. The full_name parameter is wrong. As it appears in Add/Remove programs it does not have the version as a part of the full name. I updated the winrepo and removed the version. (https://github.com/saltstack/salt-winrepo-ng/pull/1522)
Additionally, this package did not install silently for me. I think it's because the package is unsigned. It pops up a dialog box asking if you want to install anyway. When you add the silent switches /qn it won't install quietly. I think it will if it is signed.
It works now:
ID: check-mk-agent-msi
Function: pkg.installed
Result: True
Comment: 1 targeted package was installed/updated.
Started: 13:20:14.540181
Duration: 51873.77 ms
Changes:
----------
check-mk-agent-msi:
----------
new:
1.5.0.3268
old:
1.4.0.2940