Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_wua should have possibility to specify source file #46292

Closed
asymetrixs opened this issue Mar 2, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@asymetrixs
Copy link

commented Mar 2, 2018

Description of Issue/Question

When using win_wua, it uses the Windows Update Agent to install updates. However, sometimes systems are not connected to the internet, nor does the WSUS server contain all updates (and updating it is not an option). It would be good to have the possibility to point win_wua to a file location when installing an update.

@garethgreenaway garethgreenaway added this to the Approved milestone Mar 2, 2018

@garethgreenaway

This comment has been minimized.

Copy link
Member

commented Mar 2, 2018

@asymetrixs Thanks for the report. This would be a great feature to have. cc @twangboy

@twangboy

This comment has been minimized.

Copy link
Contributor

commented Mar 3, 2018

@asymetrixs This feature cannot be added to the win_wua module as it only leverages the Windows update agent. However, the win_dism module should do what you need. See docs for win_dism.add_package (https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.win_dism.html#salt.modules.win_dism.add_package)

@asymetrixs

This comment has been minimized.

Copy link
Author

commented Mar 5, 2018

I tried with win_dism.package_installed state but it throws an error regarding the path. Unfortunately it does not support a path like 'salt://[path]/[file]'. This would be useful.

@asymetrixs

This comment has been minimized.

Copy link
Author

commented Mar 5, 2018

I just tried the following which is not an ideal state, as the .msu-file gets copied every time:

WMF-Copy:
  file.managed:
    - name: C:\Windows\Temp\KB3191566.msu
    - source: salt://applications/KB3191566.msu

WMF-Install:
  dism.package_installed:
    - name: C:\Windows\Temp\KB3191566.msu

WMF-Remove:
  file.absent:
    - name: C:\Windows\Temp\KB3191566.msu

However, copying the file to the temporary location and deleting it works, even though it would be done every time when the state is run (bad of course) but dism.package_install throws an error:

ID: WMF-Install
Function: dism.package_installed
Name: C:\Windows\Temp\KB3191566.msu
Comment: An exception occurred in this state: Traceback (most recent call last):
  File "c:\salt\bin\lib\site-packages\salt\state.py", line 1843, in call
    **cdata['kwargs'])
  File: "c:\sa;t\bin\lib\site-packages\salt\loader.py", line 1795, in wrapper
    return f(*args, **kwargs)
  File: "c:\salt\bin\lib\site-packages\salt\states\win_dism.py", libe 337, in package_installed
    if package_info['Package Identity'] in old:
  KeyError: 'Package Identity'
Started: [...]
Duration: [...]
Changes: 

Salt Version:
    Salt: 2017.7.2
  
Dependency Versions:
    cffi:             1.10.0
    cherrypi:         10.2.1
    dateutil:         2.6.0
    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:           3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)]
    python-gnupg:     0.4.0
    PyYAML:           3.12
    PyZMQ:            16.0.2
    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:          7
    system:           Windows
    version:          7 6.1.7601 SP1 Multiprocessor Free

@twangboy twangboy self-assigned this Mar 6, 2018

@asymetrixs

This comment has been minimized.

Copy link
Author

commented Mar 14, 2018

@twangboy is there a road map for this or is it just on the list to be implemented some day?

@twangboy

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2018

@asymetrixs I'm looking at the package for KB3191566 on Windows 7 and it looks like there are some prerequisites that it requires in order to install.
One is that WMF 3.0 can NOT be present on the system already. That would need to be uninstalled first.
Second is that it requires .Net 4.5 or above.
So, you'll probably have to be sure those are present before you run the win_dism command.

@twangboy

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2018

Actually, digging a little further, it looks like dism only supports installing .msu packages on offline images.
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-operating-system-package-servicing-command-line-options#span-idadd-packagepackagepathpathtocabfileignorecheckpreventpendingspanspan-idadd-packagepackagepathpathtocabfileignorecheckpreventpendingspanspan-idadd-packagepackagepathpathtocabfileignorecheckpreventpendingspanadd-package

Looks like wusa.exe might be what we need here. We could add wusa to the win_wua module and allow you to specify msu files that way, or we could create a win_wusa.py execution and state module.

@dwoz What do you think? Add to win_wua or create new modules? wusa.exe basically has one purpose... to install .msu files. So, I think it's closely related enough to win_wua to put it in there as an additional function.

In the meantime, you could try stripping the cab file out of the .msu file and using that with win_dism. Or do a cmd.run state with wusa.exe to install the .msu file.

@twangboy

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2018

And dism should be fixed to allow you to pass a source option.

@rallytime rallytime closed this in fd624fd Nov 16, 2018

garethgreenaway added a commit to garethgreenaway/salt that referenced this issue Nov 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.