Filter by os_minor includes unexpected values
Description of problem:
Filter by os_minor includes unexpected values.
Version-Release number of selected component (if applicable):
1. navigate to Hosts => All Hosts
2. enter the following filter: "os_major = 6 and os_minor < 4" and click Search
If version 6.10 is included in the search results, even though 10 is not < than 4.
Notice in the other attached that 6.2 and 6.3 servers are also mentioned, and no 6.4 through 6.9 servers are in the results. However, 6.10 should also not show
Expected: only 6.0, 6.1, 6.2 and 6.3 servers should show
Updated by Marek Hulán over 4 years ago
- Subject changed from Filter by os_minor includes unexpected values on the Satellite web UI. to Filter by os_minor includes unexpected values on the Satellite web UI.
- Category changed from Inventory to Search
- Difficulty set to easy
The reason is that minor version of OS is treated as a string, because it can contain non numerical characters, e.g. 2.1511 in case of CentOS. Therefore we can only compare these value lexically. And 10 is lexically lower than 6, since 1 is earlier in alphabet than 6. For search purposes we could break all numbers apart and store them in DB as integers.
An easy workaround is to query it like "os_major = 6 and os_minor ^ (1,2,3,4)".