-
Notifications
You must be signed in to change notification settings - Fork 183
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
Basic example in Readme.rst not working for me (same with Diagnostic Walkthrough instructions) #3971
Labels
Comments
with logging added:
but, in same Python session:
|
@mulkieran the example is a bit old. Running the code I see that the default insights plugins are not installed when you invoke In [4]: results = run(report)
In [5]: results[report]
Out[5]:
{'rule_fqdn': '__main__.report',
'reason': 'MISSING_REQUIREMENTS',
'details': "All: ['insights.parsers.installed_rpms.InstalledRpms'] Any: ",
'type': 'skip'}
In [8]: results.__dict__
Out[8]:
{'instances': {insights.core.context.HostContext: <HostContext('/', 30)>,
<function __main__.report(rpms)>: {'rule_fqdn': '__main__.report',
'reason': 'MISSING_REQUIREMENTS',
'details': "All: ['insights.parsers.installed_rpms.InstalledRpms'] Any: ",
'type': 'skip'}},
'missing_requirements': {insights.specs.Specs.installed_rpms: ([], [[]]),
insights.parsers.installed_rpms.InstalledRpms: ([insights.specs.Specs.installed_rpms],
[])}, You can explicitly load the deault plugins which will ensure that when you inoke In [12]: from insights import load_default_plugins
In [13]: load_default_plugins()
In [14]: results = run(report)
In [15]: results[report]
Out[15]: {'version': 'bash-5.2.21-1.fc38', 'type': 'pass', 'pass_key': 'BASH_INSTALLED'}
In [16]: results.__dict__
Out[16]:
{'instances': {insights.core.context.HostContext: <HostContext('/', 30)>,
<insights.core.spec_factory.simple_command at 0x7f3fdc0e2f10>: CommandOutputProvider("'/bin/rpm -qa --qf \'\\{"name":"%{NAME}","epoch":"%{EPOCH}","version":"%{VERSION}","release":"%{RELEASE}","arch":"%{ARCH}","installtime":"%{INSTALLTIME:date}","buildtime":"%{BUILDTIME}","vendor":"%{VENDOR}","buildhost":"%{BUILDHOST}","sigpgp":"%{SIGPGP:pgpsig}"\\}\n\''"),
insights.specs.Specs.installed_rpms: CommandOutputProvider("'/bin/rpm -qa --qf \'\\{"name":"%{NAME}","epoch":"%{EPOCH}","version":"%{VERSION}","release":"%{RELEASE}","arch":"%{ARCH}","installtime":"%{INSTALLTIME:date}","buildtime":"%{BUILDTIME}","vendor":"%{VENDOR}","buildhost":"%{BUILDHOST}","sigpgp":"%{SIGPGP:pgpsig}"\\}\n\''"),
insights.parsers.installed_rpms.InstalledRpms: <insights.parsers.installed_rpms.InstalledRpms at 0x7f3fdc80ff50>,
<function __main__.report(rpms)>: {'version': 'bash-5.2.21-1.fc38',
'type': 'pass',
'pass_key': 'BASH_INSTALLED'}},
'missing_requirements': {<insights.core.spec_factory.first_file at 0x7f3fd7efcf90>: ([insights.core.context.SosArchiveContext],
[]),
<insights.core.spec_factory.glob_file at 0x7f3fd7e44ed0>: ([insights.core.context.HostArchiveContext],
[]),
<insights.core.spec_factory.head at 0x7f3fd7e60750>: ([<insights.core.spec_factory.glob_file at 0x7f3fd7e44ed0>],
[])}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Was hoping to use the "Diagnostic Walkthrough" instructions[1] to sample making a local insights rule, but I came a cropper.
I simply opened the Python interpreter and started entering the code. I ran the report and I got the following result
As far as I can interpret this, the failure is due to some MISSING REQUIREMENTS. But, since I imported all the things that I was supposed to import, and certainly I imported InstalledRpms, it is hard for me to discover what I did wrong. I can run
rpm -qa
without difficulty from the command-line, and get a bunch of results.I see, at the bottom of the Diagnostic Walkthrough, that I am told that I should have jupyter-notebook installed. I installed that, but I still get the same problem. I am not actually running jupyter-notebook, but still using the Python interpreter.
Then I fell back on trying the example in the README[2]:
but that didn't work out so well either:
Turns out there is one item in results, just not accessible by the specified key:
At this point, I'm hoping for some help to figure out how to make the README example work for me.
I'm running this code on a Fedora 39 machine, and never tried on a Fedora 38 machine, so I can't compare.
Happy to provide additional information.
[1] https://github.com/RedHatInsights/insights-core/blob/master/docs/notebooks/Diagnostic%20Walkthrough.ipynb
[2] https://github.com/RedHatInsights/insights-core#readme
The text was updated successfully, but these errors were encountered: