ecebe57 facts: infer_comp+_cmp_ver: handle tail ver. component(s) missing right

Authored and Committed by jpokorny 6 years ago
1 file changed. 22 lines added. 6 lines removed.
    facts: infer_comp+_cmp_ver: handle tail ver. component(s) missing right
    
    Previously, it could happen that components could get some "extras",
    accumulated as traversed through the evolutionary line, that in fact
    would not reflect the raw data.  Triggering condition in such case
    is version comparison with one the operands consisting of less
    version components -- a case in point (not present though, yet!):
    corosync 2.4 vs 2.4.3, which would incorrectly make the former
    awarded "extras" from the latter.
    
    The apparent solution for that to rectify _cmp_ver function so that
    it imagines virtual zeroes at the positions missing for version
    components parity between the two operands.  That alone, however,
    makes the "facts.TestClusterSystem.test_cluster_pcs_flatiron" unit
    test fail starting with "6.5" case.  Now, what becomes a trouble
    is that doing so breaks the logic a la "requiring version 1.x,
    which can clearly be fulfilled with 1.4" as the comparison runs
    as "(1, 0) vs. (1, 4)" rather than "1 vs. (1, 4), i.e., 1 vs. 1"
    as before (1.x here implied with how corosync=flatiron is translated
    under the hood).  Hence, as the next step, introduce new parameter
    at _cmp_ver so as to request just a prefix match comparison, and
    apply that where it matters, i.e. directly at the leaf "component"
    part of the inference mechanism, infer_comp function.
    
    Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
    
        
file modified
+22 -6