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

[BUG] win_wua.available exception when no patches are available #66718

Open
8 tasks
brettgilmer opened this issue Jul 16, 2024 · 0 comments · May be fixed by #66739
Open
8 tasks

[BUG] win_wua.available exception when no patches are available #66718

brettgilmer opened this issue Jul 16, 2024 · 0 comments · May be fixed by #66739
Assignees
Labels
Bug broken, incorrect, or confusing behavior Windows

Comments

@brettgilmer
Copy link

Description

Setup
WIndows 11 23h2 update, no available patches according to Windows UI
salt-call win_wua.available
seen in salt 3004.2 and 3006.5
this seems new.....

(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • [X ] on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior
WIndows 11 23h2 update, no available patches according to Windows UI
salt-call win_wua.available

Expected behavior
No exception, an empty-list of available patches

Screenshots

C:\>salt-call win_wua.available 09:33:08 - ERROR - salt._logging.impl - An un-handled exception was caught by Salt's global exception handler: AttributeError: <unknown>.IsHidden Traceback (most recent call last): File "C:\Salt\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Salt\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Salt\salt-call.exe\__main__.py", line 7, in <module> sys.exit(salt_call()) File "C:\Salt\lib\site-packages\salt\scripts.py", line 443, in salt_call client.run() File "C:\Salt\lib\site-packages\salt\cli\call.py", line 50, in run caller.run() File "C:\Salt\lib\site-packages\salt\cli\caller.py", line 95, in run ret = self.call() File "C:\Salt\lib\site-packages\salt\cli\caller.py", line 202, in call ret["return"] = self.minion.executors[fname]( File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 159, in __call__ ret = self.loader.run(run_func, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1245, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as return _func_or_method(*args, **kwargs) File "C:\Salt\Lib\site-packages\salt\executors\direct_call.py", line 10, in execute return func(*args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 159, in __call__ ret = self.loader.run(run_func, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1245, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as return _func_or_method(*args, **kwargs) File "C:\Salt\Lib\site-packages\salt\modules\win_wua.py", line 269, in available updates = wua.available( File "C:\Salt\lib\site-packages\salt\utils\win_update.py", line 531, in available if salt.utils.data.is_true(update.IsHidden) and skip_hidden: File "C:\Salt\lib\site-packages\win32com\client\dynamic.py", line 639, in __getattr__ raise AttributeError("%s.%s" % (self._username_, attr)) AttributeError: <unknown>.IsHidden (impl.py->__global_logging_exception_handler:1069) Traceback (most recent call last): File "C:\Salt\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Salt\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Salt\salt-call.exe\__main__.py", line 7, in <module> File "C:\Salt\lib\site-packages\salt\scripts.py", line 443, in salt_call client.run() File "C:\Salt\lib\site-packages\salt\cli\call.py", line 50, in run caller.run() File "C:\Salt\lib\site-packages\salt\cli\caller.py", line 95, in run ret = self.call() File "C:\Salt\lib\site-packages\salt\cli\caller.py", line 202, in call ret["return"] = self.minion.executors[fname]( File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 159, in __call__ ret = self.loader.run(run_func, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1245, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as return _func_or_method(*args, **kwargs) File "C:\Salt\Lib\site-packages\salt\executors\direct_call.py", line 10, in execute return func(*args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 159, in __call__ ret = self.loader.run(run_func, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1245, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) File "C:\Salt\lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as return _func_or_method(*args, **kwargs) File "C:\Salt\Lib\site-packages\salt\modules\win_wua.py", line 269, in available updates = wua.available( File "C:\Salt\lib\site-packages\salt\utils\win_update.py", line 531, in available if salt.utils.data.is_true(update.IsHidden) and skip_hidden: File "C:\Salt\lib\site-packages\win32com\client\dynamic.py", line 639, in __getattr__ raise AttributeError("%s.%s" % (self._username_, attr)) AttributeError: <unknown>.IsHidden

Versions Report

C:>salt-call --versions-report
Salt Version:
Salt: 3006.5

Python Version:
Python: 3.10.13 (heads/main:5600dd9, Nov 15 2023, 04:42:06) [MSC v.1937 64 bit (AMD64)]

Dependency Versions:
cffi: 1.14.6
cherrypy: 18.6.1
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 4.0.7
gitpython: Not Installed
Jinja2: 3.1.2
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.10.1
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 25.0.2
relenv: 0.14.2
smmap: 4.0.0
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist:
locale: cp1252
machine: AMD64
release: 10
system: Windows
version: 10 10.0.22621 SP0 Multiprocessor Free

PASTE HERE

Additional context
I wrote my own script based on what salt is doing, and I see that my "updates" array below contains a list of CDispatch objects, but they seem to be corrupted... I can not access any fields within them without throwing an exception.

`
def dbg():
import pywintypes
import salt.utils.winapi
import salt.utils.win_update as win_update
import salt.utils.data
import win32com.client

with salt.utils.winapi.Com():
    # Create a session with the Windows Update Agent
    session = win32com.client.Dispatch("Microsoft.Update.Session")

    # Create Collection for Updates
    updates = win32com.client.Dispatch("Microsoft.Update.UpdateColl")


search_string = "Type='Software' or Type='Driver'"

# Create searcher object
searcher = session.CreateUpdateSearcher()
searcher.Online = True
session.ClientApplicationID = "Salt: Load Updates"

# Load all updates into the updates collection
try:
    results = searcher.Search(search_string)
    if results.Updates.Count == 0:
        log.debug("No Updates found for:\n\t\t%s", search_string)
        return f"No Updates found: {search_string}"
except pywintypes.com_error as error:
    log.error("Search Failed:")
    return "forked it"

updates = results.Updates

for update in updates:
    log.error(f"class= {update.__class__.__name__}")


return None

`

@brettgilmer brettgilmer added Bug broken, incorrect, or confusing behavior needs-triage labels Jul 16, 2024
@twangboy twangboy self-assigned this Jul 18, 2024
@twangboy twangboy modified the milestones: 3006, 3006.10, Sulfur v3006.10 Jul 18, 2024
@twangboy twangboy linked a pull request Jul 23, 2024 that will close this issue
3 tasks
@twangboy twangboy linked a pull request Jul 23, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants