C-RH-C / hcs-collector

GNU General Public License v3.0
2 stars 5 forks source link

Rhel versions #30

Open starnold-redhat opened 1 year ago

starnold-redhat commented 1 year ago

This update reports on the different rhel versions in use - and can be used to support reporting of RHEL ELS usage. Its an implementation of issue #28

waldirio commented 1 year ago

Hello @starnold-redhat

When running with my local dataset, I got the error below

$ ./hcs-collector.py process
process data with a tag of none

## RHEL On-Demand

Max Concurrent RHEL On-Demand, referrent to ..: 2022-06
On-Demand, Physical Node .....................: 0
On-Demand, Virtual Node ......................: 0
Virtual Data Center, Virtual Node ............: 0
Unknown ......................................: 0

## RHEL Versions

Max Concurrent RHEL On-Demand, by version ....: 2022-06

## RHEL Add-ons

On-Demand, High Availability, Physical Node...: 0
On-Demand, High Availability, Virtual Node....: 0
On-Demand, Directory Server Node .............: 0

## Virtualization

On-Demand, Virtualization Sockets ............: 0

## Middleware

On-Demand, JBoss EAP Cores ...................: 0
On-Demand, JWS Cores .........................: 0

## RHEL Virtual Data Center

Virtual Data Center, Hypervisor ..............: 0
Virtual Data Center, Hypervisor Sockets ......: 0

## Ansible Managed Hosts

On-Demand, Ansible Managed Hosts .............: 0

## RHEL On-Demand

Max Concurrent RHEL On-Demand, referrent to ..: 2022-05
On-Demand, Physical Node .....................: 981
On-Demand, Virtual Node ......................: 6204
Virtual Data Center, Virtual Node ............: 53
Unknown ......................................: 0

## RHEL Versions

Traceback (most recent call last):
  File "./hcs-collector.py", line 10, in <module>
    parse.main()
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/wpinheir/deleteme/hcs-collector/parse/parse.py", line 65, in process
    execution.process_data(tag)
  File "/home/wpinheir/deleteme/hcs-collector/execution/execution.py", line 122, in process_data
    generate_report(path_to_csv_dir, csv_files_list, path_to_json_dir, json_files_list, tag)
  File "/home/wpinheir/deleteme/hcs-collector/execution/execution.py", line 136, in generate_report
    process_rhel_versions.process_rhel_versions(path_to_csv_dir, csv_files_list, tag)
  File "/home/wpinheir/deleteme/hcs-collector/execution/process_rhel_versions.py", line 67, in process_rhel_versions
    max_versions[major_os]['physical'] = stage_versions[major_os]['physical']
KeyError: '5'

Could you check this out, please?

Thank you! Waldirio

starnold-redhat commented 1 year ago

Hi - I think its when an OS is absent from the results. So I've put in some more defensive coding around that ( it was definitely an issue). So Can you try again ? I've tried a few different scenarios - and it seems ok now.

waldirio commented 1 year ago

Hello @starnold-redhat

Thank you. Just tested and everything seems ok. Waldirio

waldirio commented 1 year ago

Hello,

The code was running while I sent the last update. In the end, I got the error below

## RHEL Versions

Traceback (most recent call last):
  File "./hcs-collector.py", line 10, in <module>
    parse.main()
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/wpinheir/.venv/hcs-collector/lib64/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/wpinheir/deleteme/hcs-collector/parse/parse.py", line 65, in process
    execution.process_data(tag)
  File "/home/wpinheir/deleteme/hcs-collector/execution/execution.py", line 122, in process_data
    generate_report(path_to_csv_dir, csv_files_list, path_to_json_dir, json_files_list, tag)
  File "/home/wpinheir/deleteme/hcs-collector/execution/execution.py", line 136, in generate_report
    process_rhel_versions.process_rhel_versions(path_to_csv_dir, csv_files_list, tag)
  File "/home/wpinheir/deleteme/hcs-collector/execution/process_rhel_versions.py", line 35, in process_rhel_versions
    major_os = os_version[0]
IndexError: string index out of range
waldirio commented 2 months ago

Hello @starnold-redhat

Please, remove the folder build from this PR.

Thank you! Waldirio